JS学习之onmouseover事件与onmouseout事件实现

很简单,直接上代码

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             }

 

posted @ 2019-07-11 21:10  我叫张小凡  阅读(1481)  评论(0编辑  收藏  举报