Advertisement
kiril_dishliev

JavaScript - onmouseover / onmouseout

Nov 18th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.87 KB | None | 0 0
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head runat="server">
  3.     <title></title>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  5. <script>
  6. $(document).ready(function(){
  7.     $("p").mouseover(function(){
  8.         $("p").css("background-color", "yellow");
  9.     });
  10.     $("p").mouseout(function(){
  11.         $("p").css("background-color", "lightgray");
  12.     });
  13. });
  14.     // onmouseover / onmouseout
  15. function onmouseover() {
  16.     $("#btn1").css("background-color", "red");
  17. }
  18. function onmouseout() {
  19.     $("#btn1").css("background-color", "");
  20. }
  21. </script>
  22. </head>
  23. <body>
  24.    
  25.     <form id="form1" runat="server">
  26.     <div>
  27.         <input type="button" id="btn1" onmouseover="onmouseover()" onmouseout="onmouseout()" value="btn"/>
  28.         <p>Move the mouse pointer over this paragraph.</p>
  29.     </div>
  30.     </form>
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement