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