Advertisement
Shailrshah

Javascript Mouse Events

Jun 7th, 2014
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.     <head>
  3.         <script language = "javascript">
  4.             function changeText(id){
  5.                 id.innerHTML = "New Heading!";
  6.             }
  7.             function showDate(id){
  8.                 id.innerHTML = Date();
  9.             }
  10.             function changeImage1(id){
  11.                 id.src = "a.jpg";
  12.             }
  13.             function changeImage2(id){
  14.                 id.src = "b.jpg";
  15.             }
  16.         </script>
  17.     </head>
  18.     <body>
  19.         <h1 onmouseover = "changeText(this)"> Hover! </h1>
  20.         <p> <button onclick = "showDate(this)"> Click for latest time! </button> </p>
  21.         <img src = "b.jpg" onmousedown = "changeImage1(this)" onmouseup = "changeImage2(this)" />
  22.     </body>
  23. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement