js拼接html注意问题示例探讨


  本文标签:js,拼接html

你想让别人给你解决什么,
adress是什么,

var hrf=<a href="javascript:;" rel="external nofollow" rel="external nofollow" onclick="window.open(+url+,,"height=625,width=830,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")">+adress+</a>;

下面又出现adress[j] 。用法完全不对 。

msg+=<tr style="height:25px"><td align ="left" style="width:6%;color:Black">+coal[j]+</td><td align ="left" style="width:8%;color:Black">+url+hrf+</td><td align ="left" style="width:24%;color:Black">+adress[j]+</td><td align ="left" style="width:12%;color:Green;font-weight :bold">+ssz[j]+</td>;

追问

我是想把

<a href="javascript:;" rel="external nofollow" rel="external nofollow" onclick="window.open(+url+,,"height=625,width=830,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")">+adress+</a>

这句外面加个单引号,可是试了好多次都不成功,这句话加上单引号,里面改怎么变化呢

回答

用转义符, \" = ", \ =

追问

转义符不太会用,能给个列子吗

回答

var zz ="<tr style=\"height:25px\">";