rezamalik15

Untitled

Apr 16th, 2023
1,185
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.97 KB | None | 0 0
  1. <html lang="en">
  2. <head>
  3.     <meta charset="UTF-8">
  4.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5.     <title>Mouse Event</title>
  6.     <style>
  7.         #myButton{
  8.             text-decoration: none;
  9.             background-color: blue;
  10.             padding: 5px;
  11.             margin: 10px;
  12.             color: white;
  13.             border-radius: 5px;
  14.         }
  15.     </style>
  16. </head>
  17. <body>
  18.     <button
  19.         href=""
  20.         id="myButton"
  21.         onmouseover = mouseOver(this)
  22.         onmousedown = mouseDown(this)
  23.         onmouseup = mouseUp(this)
  24.         onclick = mouseClick()
  25.     >Not clicked
  26.     </button>
  27.     <h1 id="result"></h1>
  28.  
  29.     <script>
  30.         function mouseOver(obj){
  31.             obj.innerHTML = "Mouse over me"
  32.         }
  33.  
  34.         function mouseDown(obj){
  35.             obj.style.backgroundColor = 'grey'
  36.             obj.innerHTML = "Mouse click me, release"
  37.            
  38.         }
  39.  
  40.         function mouseUp(obj){
  41.             obj.style.backgroundColor = 'blue'
  42.             obj.innerHTML = "I am clicked"
  43.         }
  44.  
  45.         function mouseClick(){
  46.             document.getElementById('result').innerHTML = "It's all done"
  47.         }
  48.     </script>
  49. </body>
  50. </html>
Advertisement
Comments
Add Comment
Please, Sign In to add comment