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

JavaScript还能这样写一个字符串变量的?不太理解!
下面是给变量sBody赋值的代码,不太理解。如下,

var   sBody   =   '\
<table   id= "dialogBodyBox "   border= "0 "   align= "center "   cellpadding= "0 "   cellspacing= "0 "> \
<tr   height= "10 "> <td   colspan= "4 "> </td> </tr> \
<tr> \
<td   width= "10 "> </td> \
<td   width= "10 "   align= "center "   valign= "absmiddle "> <img   id= "dialogBoxFace "   border= "0 "   src= " "/> </td> \
<td   id= "dialogMsg "   style= "color:#315100;font-size:14px;font-weight:bold;line-height:125%; "> </td> \
<td   width= "10 "> </td> \
</tr> \
<tr   height= "10 "> <td   colspan= "4 "   align= "center "> </td> </tr> \
<tr> <td   id= "dialogFunc "   colspan= "4 "   align= "center "> '   +   sFunc   +   ' </td> </tr> \
<tr   height= "10 "> <td   colspan= "4 "   align= "center "> </td> </tr> \
</table> \
';

------解决方案--------------------
当然可以了,最后一个符号是续行符
再说
他字符串的开头使用单引号开头,只要里面不出现单引号就没有结束,出现双引号没有问题的