标签:proc 两种 ref stat javascrip use rip 字符串 roc
js里面拼接带:的字符串(冒号),如果这样拼接,会报js错误:缺少‘)‘,用火狐浏览器调试,发现此处拼接成了这样:javascript:pause(,后面的内容全部丢失了。var id="process:10:115010";
hm = "<a href=‘javascript:stateSet(" + id + "," + state + ")‘>停止</a>"
试了很多方法之后,发现以下两种写法可以解决以上问题
var id="process:10:115010";
hm = "<a href=‘javascript:stateSet("" + id + ""," + state + ")‘>停止</a>"
hm = "<a href=‘javascript:stateSet(\""+ id + "\"," + state + ")‘>停止</a>"
标签:proc 两种 ref stat javascrip use rip 字符串 roc
原文地址:http://blog.51cto.com/1197822/2156815