前端页面拼接计较之\

写法1:content+='<td class="f-14"><a title="编辑" href="javascript:;" onclick="system_role_edit(\'000\',\'system-category-add.html\',\'0\',\'700\',\'480\')" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>';

 

写法2:content+="<td class=\"f-14\"><a title=\"编辑\" href=\"javascript:;\" onclick=\"system_role_edit('000','system-category-add.html','0','700','480')\" style=\"text-decoration:none\"><i class=\"Hui-iconfont\">&#xe6df;</i></a>";

写法1中外面使用的'号,所以里面所有需要用到'号的都要使用转义符\转义一下

写法2中外面使用的"号,所以里面所有需要用到"号的都要使用转义符\转义一下

猜你喜欢

转载自blog.csdn.net/kevin_cat/article/details/81545387
今日推荐