onclick="this.style.borderColor='#74743A'; this.onmouseout = this.onmouseover = null;"

解决方案 »

  1.   

    逻辑混乱,看得一头雾水但我猜应该是这样吧
    先把默认值设为
    #006F1C
    然后代码里加js控制
    onclick="this.style.borderColor='#74743A'
      

  2.   


    <!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>