javascript if语句问题
document.write("<table align='center' width='350' border='1'>");
var i=1;
if(i==1){
bgColor="red";
document.write("<tr bgColor='+bgColor+'>");
document.write("<td>张三</td>");
document.write("<td>张三</td>");
document.write("<td>张三</td>");
document.write("</tr>");
}
document.write("</table>");
document.write("<tr bgColor='+bgColor+'>");中为什么前后都加了一个“+”号。
这样表格的背景颜色是绿色。
我设置的应该是红色才对。
把“+”号去了才能变成红色
正序查看

暂无评论