var tbl = document.getElementById("Table2");
var trs = tbl.getElementsByTagName("tr");
for(i=0;i<trs.length;i++)
{
trs[i].onmouseover = function(e){
if(this.cc!=true)
this.style.backgroundColor='#7FFFD4';
}
trs[i].onclick = function(e){
this.cc=!this.cc;
this.style.backgroundColor = (this.cc==true) ? '#90EE90' : '#e4e8ef';
}
trs[i].onmouseout = function(e){
if(this.cc!=true)
this.style.backgroundColor='#e4e8ef';
}
}
var trs = tbl.getElementsByTagName("tr");
for(i=0;i<trs.length;i++)
{
trs[i].onmouseover = function(e){
if(this.cc!=true)
this.style.backgroundColor='#7FFFD4';
}
trs[i].onclick = function(e){
this.cc=!this.cc;
this.style.backgroundColor = (this.cc==true) ? '#90EE90' : '#e4e8ef';
}
trs[i].onmouseout = function(e){
if(this.cc!=true)
this.style.backgroundColor='#e4e8ef';
}
}
解决方案 »
- 求教一个问题 关于VML 以及ajax的。会的都进来看看吧
- 求 js倒计时代码 到了时间后 开始执行下一个命令
- UltraEdit 替换文字问题 --高手进
- 读取循环显示的某个textarea控件,获取其值
- 如何屏蔽服务器上强制弹出的广告?内详 (在线等,解决了马上结贴!)
- 文本处理问题,如何对关键词高亮显示
- 05_Oct_22(年_月_日)varchar(50)怎么提取转换为 datetime类型
- 请问如何判断某弹出窗口已存在?
- 如何固定一个<select >的长度
- 冒死求下列JAVASCRIPT
- eglic(圪圪) 进来,给剩余的200分你
- 为什么scrollHeight 在htc中是0呢?
<HEAD>
<TITLE>uu</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY>
<div align="center">
<TABLE id=Table2 cellSpacing=1 cellPadding=0 width="100%" bgColor=#FFFFFF border=0>
<TR align=middle>
<TD noWrap width="5%">0</TD>
<TD noWrap width="5%">O
</TR>
<TR align=middle>
<TD noWrap width="5%">0</TD>
<TD noWrap width="5%">O
</TR>
</TABLE>
</div>
<script language="JavaScript" type="text/javascript">
window.onload = function(){
var trs = document.getElementById("Table2").getElementsByTagName("tr");
for (var i = 0; i < trs.length; i++){
trs[i].setAttribute("flag", false);
trs[i].onmouseover = _onmouseover;
trs[i].onclick = _onclick;
trs[i].onmouseout = _onmouseout;
}function _onmouseover() {
if(this.getAttribute("flag") != true){
this.style.backgroundColor = "#7FFFD4";
}
}function _onclick(){
this.getAttribute("flag") == true ? this.setAttribute("flag", false) : this.setAttribute("flag", true);
this.getAttribute("flag") == true ? this.style.backgroundColor = "#90EE90" : this.style.backgroundColor = "#e4e8ef";
}function _onmouseout(){
if(this.getAttribute("flag") != true){
this.style.backgroundColor = "#e4e8ef";
}
}
}
</script></BODY>
</HTML>
虽然我己经写了一个,但还是你的好。谢谢。