hover Select the element on which the mouse pointer floats , And can be styled .

But in DOM In operation , We can't set it directly hover attribute . For this effect, we can register an element directly onmouseover( Mouse in ) and onmouseout( Mouse away ) event , Then change the style of the tag in the event handler , So you can have hover Properties .

for example :
<body> <ul> <li> snowflake </li> <li> Budweiser </li> <li> Peking </li> <li> Qingdao </li> <li> Laoshan </li>
<li> Pearl River </li> </ul> </body> <script> // Get all li label var list =
document.getElementsByTagName("li"); for (var i = 0; i < list.length; i++) {
// by li Register mouse entry events list[i].onmouseover = function () { // Set its background color to yellow
this.style.backgroundColor = "yellow"; }; // by li Register mouse exit event list[i].onmouseout =
function () { // Restore to the default color of this label this.style.backgroundColor = ""; }; } </script>

©2019-2020 Toolsou All rights reserved,
JS How to operate java Realize the function of grabbing red packets C Language programming to find a student's grade The United Nations 《 Glory of Kings 》 Please go to the studio : To save the earth Dialogue between apple and Nissan suspended ,Apple Car How's it going ?CSS architecture design China's longest high speed rail officially opened ! The fastest way to finish the race 30.5 hour First knowledge MySQL Comprehensive review ( dried food )2021 year 1 Monthly programmer salary statistics , average 14915 element How to use it quickly html and css Write static page