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             }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM