Javascript onmouseover and onmouseout event

Onmouseover event


जब Element पर या उसके child element पर mouse cursor; जब hover किया जाता है तब ये event सक्रिय हो जाता है |

Onmouseout event

जब Element पर या उसके child element पर mouse cursor; जब out किया जाता है तब ये event सक्रिय हो जाता है |

onmouseover और onmouseout का प्रोग्राम नीचे दिया गया हैं ------

 <html>

    <head>
        <style>
            div{
               
background-color: teal;
               
font-style: italic;
               
font-size: 25px;
               
font-family: 'Times New Roman', Times, serif;
               
color: white;
            }
       
</style>
    </head>
    <body>
        <h1>javascript event</h1>
        <div onmouseover="over()" onmouseout="out()" id="aa">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat obcaecati ullam autem error tempore. Quia neque voluptatum ipsum exercitationem rerum, unde obcaecati eveniet ratione adipisci iure distinctio quos, minus veritatis?</div>
        <button type="button" onclick="myfunction()">click here</button>
        <h1 id="demo"></h1>
        <script>
            function myfunction(){
                document.getElementById(
"demo").innerHTML="this is a event";
            }
           
function over(){
                document.getElementById(
"aa").style.color="red";
                document.getElementById(
"aa").style.backgroundColor="yellow";
            }
           
function out(){
                document.getElementById(
"aa").style.color="white";
                document.getElementById(
"aa").style.backgroundColor="black";
            }
       
</script>
    </body>
</html>

Post a Comment

Previous Post Next Post