您现在的位置是:首页 > 电脑技术查询 > web开发

javascript里的单双引号有关问题

编辑:chaxungu时间:2022-10-02 23:18:16分类:web开发

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>

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