很简单,直接上代码
html:
1 <tr onmouseover="mover('userName1')" onmouseout="mout('userName1')" id="userName1"> 2 <td> 3 姓名 4 </td> 5 6 <td> 7 * 8 <input type="text" name="userName" id="userName" onfocus="of('userName')" onblur="ob()" required="required" /> 9 10 </td> 11 </tr>
JS代码:
1 function mover(id){ 2 document.getElementById(id).style.backgroundColor="pink"; 3 4 } 5 function mout(id){ 6 document.getElementById(id).style.backgroundColor="white"; 7 }