[Help]代码冲突 不对吧,好像你第一段代码是改变行的背景,而第二段是改变单个cell的背景色,当设置了cell的背景色后,行的背景色就被遮挡了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把你的整个代码发上来,或者[email protected] <head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Untitled Document</title></head><body><Script Lanuage=JavaScript>function ChangeRowBackGround(RowID) { var Row = document.getElementById(RowID) var BackGround = Row.style.background.toUpperCase(); if (BackGround.match("#E4E8EF")) { Row.style.background = "#FFCCFF"; } else { Row.style.background = "#E4E8EF"; } } function ChangeRowBackGround2(tableid) { var rows = document.getElementById(tableid).rows; var len = rows.length; for(var i=0 ;i<len; i++) { if (rows[i].cells[2].style.backgroundColor.toUpperCase().match("#E4E8EF")) { rows[i].cells[2].style.backgroundColor = "#FFCCFF"; } else { rows[i].cells[2].style.backgroundColor = "#E4E8EF"; } } }</Script><input type="checkbox" onClick="ChangeRowBackGround2('aaa')" value="All"><br><table width="500" border="1" cellpadding="2" cellspacing="3" bgcolor="#FFCCFF" id="aaa"><tr align="center" id="Row01" onClick="ChangeRowBackGround('Row01');"><td width="30">11111</td> <td>11111111111111111</td> <td>1111111111111111111111111</td></tr><tr align="center" id="Row02" onClick="ChangeRowBackGround('Row02');"><td>22222</td> <td>22222222222222222</td> <td>2222222222222222222222222</td></tr><tr align="center" id="Row03" onClick="ChangeRowBackGround('Row03');"><td>33333</td> <td>33333333333333333</td> <td>3333333333333333333333333</td></tr></table></body></html> <head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Untitled Document</title></head><body><Script Lanuage=JavaScript>function ChangeRowBackGround(RowID) { var Row = document.getElementById(RowID) var BackGround = Row.style.background.toUpperCase(); if (BackGround.match("#E4E8EF")) { Row.style.background = "#FFCCFF"; } else { Row.style.background = "#E4E8EF"; } } function ChangeRowBackGround2(tableid) { var rows = document.getElementById(tableid).rows; var len = rows.length; for(var i=0 ;i<len; i++) { if (rows[i].cells[2].style.backgroundColor=="") { rows[i].cells[2].style.backgroundColor = "#FFCCFF"; } else { rows[i].cells[2].style.removeAttribute("backgroundColor"); } } }</Script><input type="checkbox" onClick="ChangeRowBackGround2('aaa')" value="All"><br><table width="500" border="1" cellpadding="2" cellspacing="3" bgcolor="#FFCCFF" id="aaa"><tr align="center" id="Row01" onClick="ChangeRowBackGround('Row01');"><td width="30">11111</td> <td>11111111111111111</td> <td>1111111111111111111111111</td></tr><tr align="center" id="Row02" onClick="ChangeRowBackGround('Row02');"><td>22222</td> <td>22222222222222222</td> <td>2222222222222222222222222</td></tr><tr align="center" id="Row03" onClick="ChangeRowBackGround('Row03');"><td>33333</td> <td>33333333333333333</td> <td>3333333333333333333333333</td></tr></table></body> 更新后,全选功能失效了!-------- 是灰颜色表示选中吗?还以为是红颜色表示选中呢!自己改一下试试:line30:rows[i].cells[2].style.backgroundColor = "#FFCCFF";----->>>>>rows[i].cells[2].style.backgroundColor = "#E4E8EF"; 喔!我JAVASCRIPT可差劲了,ASP还可以。 js问题 急急急!!!!!!!!!!! 简单的js解析xml select动态添加删除选项,添加的option只出现在最后一个select? javascript里怎麼得到上一個頁面Url的值 showModalDialog之后怎么关闭啊! 求验证出生日期的JS! 关于设置Div的显示位置的问题? 在没提交表单的情况下 如何动态获取表单的值呢? 这个效果怎么做??? 求助个jquery DIV取值的问题 如何实现两个<Selectd>对象的联动? js问题,如何传递表单名,及表单里的值?
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
</head><body>
<Script Lanuage=JavaScript>
function ChangeRowBackGround(RowID)
{
var Row = document.getElementById(RowID)
var BackGround = Row.style.background.toUpperCase();
if (BackGround.match("#E4E8EF"))
{
Row.style.background = "#FFCCFF";
}
else
{
Row.style.background = "#E4E8EF";
}
}
function ChangeRowBackGround2(tableid)
{
var rows = document.getElementById(tableid).rows;
var len = rows.length; for(var i=0 ;i<len; i++)
{
if (rows[i].cells[2].style.backgroundColor.toUpperCase().match("#E4E8EF"))
{
rows[i].cells[2].style.backgroundColor = "#FFCCFF";
}
else
{
rows[i].cells[2].style.backgroundColor = "#E4E8EF";
}
}
}
</Script>
<input type="checkbox" onClick="ChangeRowBackGround2('aaa')" value="All">
<br>
<table width="500" border="1" cellpadding="2" cellspacing="3" bgcolor="#FFCCFF" id="aaa">
<tr align="center" id="Row01" onClick="ChangeRowBackGround('Row01');"><td width="30">11111</td>
<td>11111111111111111</td>
<td>1111111111111111111111111</td>
</tr>
<tr align="center" id="Row02" onClick="ChangeRowBackGround('Row02');"><td>22222</td>
<td>22222222222222222</td>
<td>2222222222222222222222222</td>
</tr>
<tr align="center" id="Row03" onClick="ChangeRowBackGround('Row03');"><td>33333</td>
<td>33333333333333333</td>
<td>3333333333333333333333333</td>
</tr>
</table>
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
</head><body>
<Script Lanuage=JavaScript>
function ChangeRowBackGround(RowID)
{
var Row = document.getElementById(RowID)
var BackGround = Row.style.background.toUpperCase();
if (BackGround.match("#E4E8EF"))
{
Row.style.background = "#FFCCFF";
}
else
{
Row.style.background = "#E4E8EF";
}
}
function ChangeRowBackGround2(tableid)
{
var rows = document.getElementById(tableid).rows;
var len = rows.length; for(var i=0 ;i<len; i++)
{
if (rows[i].cells[2].style.backgroundColor=="")
{
rows[i].cells[2].style.backgroundColor = "#FFCCFF";
}
else
{
rows[i].cells[2].style.removeAttribute("backgroundColor");
}
}
}
</Script>
<input type="checkbox" onClick="ChangeRowBackGround2('aaa')" value="All">
<br>
<table width="500" border="1" cellpadding="2" cellspacing="3" bgcolor="#FFCCFF" id="aaa">
<tr align="center" id="Row01" onClick="ChangeRowBackGround('Row01');"><td width="30">11111</td>
<td>11111111111111111</td>
<td>1111111111111111111111111</td>
</tr>
<tr align="center" id="Row02" onClick="ChangeRowBackGround('Row02');"><td>22222</td>
<td>22222222222222222</td>
<td>2222222222222222222222222</td>
</tr>
<tr align="center" id="Row03" onClick="ChangeRowBackGround('Row03');"><td>33333</td>
<td>33333333333333333</td>
<td>3333333333333333333333333</td>
</tr>
</table>
</body>
--------
是灰颜色表示选中吗?
还以为是红颜色表示选中呢!自己改一下试试:
line30:
rows[i].cells[2].style.backgroundColor = "#FFCCFF";
----->>>>>
rows[i].cells[2].style.backgroundColor = "#E4E8EF";