asimryu

js basic 1

Sep 14th, 2014
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Untitled Document</title>
  6. </head>
  7. <body>
  8. <button onclick="cb('red')" onMouseOver="cb2(this,'red')" onMouseOut="cb2(this,'gray')">red</button>
  9. <button onclick="cb('green')" onMouseOver="cb2(this,'green')" onMouseOut="cb2(this,'gray')">green</button>
  10. <button onclick="cb('blue')" onMouseOver="cb2(this,'blue')" onMouseOut="cb2(this,'gray')">blue</button>
  11. <script>
  12. function cb(c){
  13. document.body.style.background = c;
  14. }
  15. function cb2(e,c){
  16. e.style.background = c;
  17. }
  18. var ua=navigator.userAgent;
  19. document.write(ua);
  20. document.body.style.background = "#0F0";
  21. </script>
  22. </body>
  23. </html>
Advertisement
Add Comment
Please, Sign In to add comment