<tr height="21" onmouseover="this.bgColor='#cccccc';SetStock(0);"
onmouseout="this.bgColor='#FFFFFF'">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr><tr height="21" onmouseover="this.bgColor='#cccccc';SetStock(1);"
onmouseout="this.bgColor='#FFFFFF'">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr><tr height="21" onmouseover="this.bgColor='#cccccc';SetStock(2);"
onmouseout="this.bgColor='#FFFFFF'">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Untitled Document</title>
            <script language="javascript">
                var which_stock = 0;
                
                function SetStock(num){
                    which_stock = num;
                }
            </script>
        </head>
        <body>
            <table border="1">
                <?php
    for($i=0;$i<10;$i++)
    {
                ?>
                <tr height="21" onmouseover="this.bgColor='#cccccc';SetStock(<?php echo $cc;?>);" onmouseout="this.bgColor='#FFFFFF'">
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <?php
    }
                ?>
            </table>
        </body>
    </html>
      

  2.   

    <div onMouseOver="this.innerHTML='1'" onMouseOut="this.innerHTML='10000'">10000</div>
      

  3.   

    onMouseOver 代表鼠标划过
    onMouseOut 代表鼠标划出