eval("document.all.row"+ rowID).bgColor = "blue";

解决方案 »

  1.   

    <script language="javascript">
    function select_row(rowID)
    {
    document.getElementById("row"+rowID).bgColor="blue";
    }
    </script>
      

  2.   

    <form name="Form1"><table width=100%>
    <tr id="row0" onclick="select_row(this)"><td>...</td></tr>
    <tr id="row0" onclick="select_row(this)"><td>...</td></tr>
    <tr id="row0" onclick="select_row(this)"><td>...</td></tr></table></form>
    <script language="javascript">
    var theCurrentTr;
    function select_row(obj)
    {
    if(theCurrentTr!=null) theCurrentTr.bgColor="";
    theCurrentTr=obj;
    theCurrentTr.bgColor="cccccc";}
    </script>
      

  3.   

    <form name="Form1"><table width=100% bgcolor=cccccc onmouseout="select_row(null)">
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    </table></form>
    <script language="javascript">
    var theCurrentTr;
    function select_row(obj)
    {
    if(theCurrentTr!=null) theCurrentTr.bgColor="";
    theCurrentTr=obj;
    if(theCurrentTr!=null) theCurrentTr.bgColor="blue";}
    </script>
      

  4.   

    <form name="Form1"><table width=100% bgcolor=cccccc onmouseout="select_row(null)">
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    </table></form>
    <script language="javascript">
    var theCurrentTr;
    function select_row(obj)
    {
    if(theCurrentTr!=null) theCurrentTr.bgColor="";
    theCurrentTr=obj;
    if(theCurrentTr!=null) theCurrentTr.bgColor="blue";}
    </script>
      

  5.   

    <form id="Form1"><table width=100%>
    <tr id="row0" onclick="select_row('0')"><td>...</td></tr>
    <tr id="row0" onclick="select_row('1')"><td>...</td></tr>
    <tr id="row0" onclick="select_row('2')"><td>...</td></tr></table></form>
    <script language="javascript">
    function select_row(obj)
    {
    Form1.childNodes[obj].bgcolor="blue";}
    </script>