<body>
<script>
function aa(arg_color){
 if( typeof(document.all('t1').length) != "undefined"){
  var oTable = document.all('t1');
  for(var i =0;i < oTable.length;i++)
  oTable[i].style.color = arg_color;
 }
}
</script>
<table id=t1 style='color:red' onmouseover='aa(this.style.color);'> <tr><td>a</td><td>b</td></tr></table>
<table id=t1 style='color:green' onmouseover='aa(this.style.color);'> <tr><td>c</td><td>d</td></tr></table>
</body>

解决方案 »

  1.   

    <body>
    <script>
    function aa(arg_color){
     if( typeof(document.all('t1').length) != "undefined"){
      var oTable = document.all('t1');
      for(var i =0;i < oTable.length;i++)
      oTable[i].style.color = arg_color;
     }
    }
    </script>
    <table id=t1 style='color:red' onmouseover='aa(this.style.color);'> <tr><td>a</td><td>b</td></tr></table>
    <table id=t1 style='color:green' onmouseover='aa(this.style.color);'> <tr><td>c</td><td>d</td></tr></table>
    </body>
      

  2.   

    <style>
    TD{Define:onmousemove=new function(if(id=="TDID"){this.style.bgColor='#EEEEEE';})}
    </style>
      

  3.   

    改一下:
    function aa(arg_color){
    var t = document.all('t1');
    if(typeof(t.length)=="undefined")t=[t];
      for(var i =0;i < t.length;i++)
      t[i].style.color = arg_color;
    }
      

  4.   

    还有一点问题,因为我那些table的id是动态生成的,所以document.all('t1')这里的t1是需要在onmouseover='aa(this.style.color);'这个方法里传过去才行,那应该怎么传啊
    不好意思啊,我javascript很菜,请多多指教,答了马上给分
      

  5.   

    <script>
    function aa(id, arg_color){
    var t = document.all(id);
    if(typeof(t.length)=="undefined")t=[t];
      for(var i =0;i < t.length;i++)
      t[i].style.color = arg_color;
    }
    </script>
    <table id=t1 onmouseover='aa(this.id, "red");'> <tr><td>a</td><td>b</td></tr></table>
    <table id=t1 onmouseover='aa(this.id, "green");'> <tr><td>c</td><td>d</td></tr></table>
      

  6.   

    你改这句有什么不同啊if(typeof(t.length)=="undefined")t=[t];能给小第解析一下吗