鼠标单击表格颜色固定,而不是鼠标移开的颜色? onclick="this.style.borderColor='#74743A'; this.onmouseout = this.onmouseover = null;" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 逻辑混乱,看得一头雾水但我猜应该是这样吧先把默认值设为#006F1C然后代码里加js控制onclick="this.style.borderColor='#74743A' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head></head><body><script language='javascript'> function setAttr(){ var tdAry=document.getElementsByTagName("td"); for(var i=0;i<tdAry.length;i++){ (function(i){ var sign=false; tdAry[i].onclick=function(){ this.style.backgroundColor="blue"; sign=true;}; tdAry[i].onmouseover=function(){if(!sign) this.style.backgroundColor="red";}; tdAry[i].onmouseout=function(){if(!sign) this.style.backgroundColor="white";}; })(i); } }window.onload=setAttr;</script><TABLE id=AutoNumber1> <TBODY> <TR> <td onmouseover="this.style.borderColor='#00FF00';" style="BORDER-RIGHT: 3px solid; BORDER-TOP: 3px solid; BORDER-LEFT: 3px solid; BORDER-BOTTOM: 3px solid; BORDER-COLLAPSE: collapse" onmouseout="this.style.borderColor='#006F1C'" borderColor="#006F1C" onclick="this.style.borderColor='#74743A';"> <img title="王五" src="lvcaodi.jpg" width="50" height="50"/> </td> <td onmouseover="this.style.borderColor='#00FF00';" style="BORDER-RIGHT: 3px solid; BORDER-TOP: 3px solid; BORDER-LEFT: 3px solid; BORDER-BOTTOM: 3px solid; BORDER-COLLAPSE: collapse" onmouseout="this.style.borderColor='#006F1C'" borderColor="#006F1C" onclick="this.style.borderColor='#74743A';"> <img title="科斯" src="lvcaodi.jpg" width="50" height="50" /> </td> </TR> </TBODY> </TABLE> </body></html> 请教一个(获取系统时间)的问题 求助,利用JS实现在页面载入时候的类似验证码的功能 button的onclick事件函数带参数 JQuery Ajax 页面加载…急急急!在线等…… 关于attachEvent的问题? 妹妹急求一个类似outlook的菜单 如何实现这样的特效?有些菜,请帮助! 那位有JAVASCRIPT 的中文手册下载 同事说B/S没有技术含量....真的吗? Vue resource get 跨域请求的加头问题 用过FckEditor 的过来看看? 如何用JS 向它的输入框插入数据。 (解决完立即给分) 求个只能输入数字和小数的JS
先把默认值设为
#006F1C
然后代码里加js控制
onclick="this.style.borderColor='#74743A'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head><body>
<script language='javascript'>
function setAttr(){
var tdAry=document.getElementsByTagName("td");
for(var i=0;i<tdAry.length;i++){
(function(i){
var sign=false;
tdAry[i].onclick=function(){ this.style.backgroundColor="blue"; sign=true;};
tdAry[i].onmouseover=function(){if(!sign) this.style.backgroundColor="red";};
tdAry[i].onmouseout=function(){if(!sign) this.style.backgroundColor="white";};
})(i);
} }
window.onload=setAttr;
</script>
<TABLE id=AutoNumber1>
<TBODY>
<TR>
<td onmouseover="this.style.borderColor='#00FF00';" style="BORDER-RIGHT: 3px solid; BORDER-TOP: 3px solid; BORDER-LEFT: 3px solid; BORDER-BOTTOM: 3px solid; BORDER-COLLAPSE: collapse" onmouseout="this.style.borderColor='#006F1C'" borderColor="#006F1C" onclick="this.style.borderColor='#74743A';"> <img title="王五" src="lvcaodi.jpg" width="50" height="50"/> </td>
<td onmouseover="this.style.borderColor='#00FF00';" style="BORDER-RIGHT: 3px solid; BORDER-TOP: 3px solid; BORDER-LEFT: 3px solid; BORDER-BOTTOM: 3px solid; BORDER-COLLAPSE: collapse" onmouseout="this.style.borderColor='#006F1C'" borderColor="#006F1C" onclick="this.style.borderColor='#74743A';"> <img title="科斯" src="lvcaodi.jpg" width="50" height="50" /> </td>
</TR> </TBODY> </TABLE> </body>
</html>