Posted By

Feb30th1712 on 01/24/08


Tagged

css javascript event html style


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

skywalker


attach style and script to an ID


 / Published in: HTML
 

Get style and scripts (onclick, onmouseover, etc) out of tags.

  1. <head>
  2. <style>
  3. #google {color: white; background: black}
  4. </style>
  5. </head>
  6. <body>
  7. <a id="google" href="http://google.com/">google.com</a>
  8. <script type="text/javascript">
  9. document.getElementById("google").onclick = function() { return false; };
  10. </script>
  11. <body>
  12. </html>

Report this snippet  

You need to login to post a comment.