<html>
<head>
<script language="javascript">
function dosome(obj)
{
obj.className = "a1"
}
</script>
<style type="text/css">
.a1 { color:#F00;}
.a1 a {text-decoration:none;color: #F00}
</style>
</head>
<body ><table width="546" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="546" onClick="dosome(this)">1</td>
  </tr>
<tr>
<td width="546" onmouseover="dosome(this)"><a href = "163.com">2</a></td>
</tr>
</table>
</body>
</html>

解决方案 »

  1.   

    直接设置
    a:hover{
       color:red;
    }
      

  2.   

    chouchy(城市刀客) 真是热心啊太谢谢了
    如果想让超联接每隔一秒变一次色,怎么做?
      

  3.   

    <html>
    <head>
    <script language="javascript">
    var _st = window.setTimeout;
    window.setTimeout = function(fRef,mDelay)
    {
    if(typeof fRef =="function")
    {
    var argu=Array.prototype.slice.call(arguments,2);
    var f=(
    function(){
    fRef.apply(null, argu);
    }
    );
    return _st(f,mDelay);
    }
    return _st(fRef,mDelay);
    }
    var flag=true;
    function dosome(obj)
    {
    if(flag)
    {
    obj.className = "a2";
    flag=false;
    }
    else
    {
    obj.className = "a1";
    flag=true;
    }
    setTimeout(dosome,1000,obj);
    }</script>
    <style type="text/css">
    .a1 { color:#F00;}
    .a2 { color:#00F;}
    .a1 a {text-decoration:none;color: #F00}
    .a2 a {text-decoration:none;color: #00F}
    </style>
    </head>
    <body ><table width="546" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="546" onClick="dosome(this)">1</td>
      </tr>
    <tr>
    <td width="546" onmouseover="dosome(this)" onmouseout="NotDo()"><a href = "163.com" class=a1>2</a></td>
    </tr>
    </table>
    </body>
    </html>
      

  4.   

    如果你还想鼠标停下来颜色不变了,代码再改下
    <html>
    <head>
    <script language="javascript">
    var _st = window.setInterval;
    window.setInterval = function(fRef,mDelay)
    {
    if(typeof fRef =="function")
    {
    var argu=Array.prototype.slice.call(arguments,2);
    var f=(
    function(){
    fRef.apply(null, argu);
    }
    );
    return _st(f,mDelay);
    }
    return _st(fRef,mDelay);
    }
    var flag=true;
    function dosome(obj)
    {
    if(flag)
    {
    obj.className = "a2";
    flag=false;
    }
    else
    {
    obj.className = "a1";
    flag=true;
    }
    }
    function dosomedo(obj)
    {
    cf=setInterval(dosome,1000,obj);
    }
    function NotDo()
    {
    clearInterval(cf);
    }</script>
    <style type="text/css">
    .a1 { color:#F00;}
    .a2 { color:#00F;}
    .a1 a {text-decoration:none;color: #F00}
    .a2 a {text-decoration:none;color: #00F}
    </style>
    </head>
    <body ><table width="546" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="546" onClick="dosome(this)">1</td>
      </tr>
    <tr>
    <td width="546" onmouseover="dosomedo(this)" onmouseout="NotDo()"><a href = "163.com" class=a1>2</a></td>
    </tr>
    </table>
    </body>
    </html>
      

  5.   

    cf=setInterval(dosome,1000,obj);
    怎么传递了三个参数? 标准用法不是两个?var argu=Array.prototype.slice.call(arguments,2);
    是什么意思
      

  6.   

    是三个,这个是fason的用法,重载了这个方法下面这句就是说
    var argu=Array.prototype.slice.call(arguments,2);
    对传进来的参数进行截断2个
    Array.prototype.slice这句的意思是数组的截断函数而不是字符串的截断函数
    call调用
    arguments为参数对象
    2截取几个
      

  7.   

    SORRY!上面的回复可能会使人误会
    标准的用法是两个参数
    上面说的“是三个”的意思是在这里是三个
    :)
      

  8.   

    var argu=Array.prototype.slice.call(arguments,2);
    就是 
    var argu=Array.prototype.slice.call(数组—— dosome,1000); 吧那后面的obj干吗用,给function dosome(obj)当参数?怎么重载,苯,不大明白...