日期:2014-05-16  浏览次数:20354 次

javascript里的单双引号问题
document.write( ' <a     href= "# "> 设为首页 </a>     ');    
我现在想在里面加上这一句该怎加呢,    
onclick= "this.style.behavior= 'url(#default#homepage) ';this.setHomePage( 'http://www.163.com '); "     谢谢

------解决方案--------------------
<script>
document.write( ' <a href= "# " onclick= "this.style.behavior=\ 'url(#default#homepage)\ ';this.setHomePage(\ 'http://www.163.com\ '); "> Set Front Page </a> ');
</script>

------解决方案--------------------
单双引号可以嵌套,但要对称,一般用双引号在外面,单引号在里面,如果里面还有引号就用“\“”进行转义