封神梦想 - 2006-11-10 11:27:00
var winstr="<table style=\"border: 1 solid #ff0000\" width=\"241\" height=\"172\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=http://images.blogcn.com/2006/4/9/9/geniusmaomao,2006040916654.jpg>";
winstr+="<tr><td height=\"30\"> </td></tr><tr><td align=\"center\"><table width=\"90%\" height=\"110\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
winstr+="<tr><td valign=\"top\" style=\"font-size:12px; color: #ffffff; face: Tahoma\">"+msgstr+"</td></tr></table></td></tr></table>";
}
以上的代码中如<td valign=\"top\">还有好多地方都用了\" \"这是什么意思,什么时候用到它.小弟不太明白
默默的情怀 - 2006-11-20 12:52:00
举个小例子先:
var str="woshuo:\"wo kao!\"";
在上例中,"前加了\,其原因是,若不加\,在编译时,系统会认为变量str只到woshuo:就结束了,而后面的则会认为是程序错误.
一些Javascript语言中本身用到的符号出现在变量中时,就要在前面加\,称之为转义符,以免造成语法错误.
© 2000 - 2026 Rising Corp. Ltd.