Posted By

pauliehaha on 03/24/10


Tagged

html


Versions (?)

Clickable Background


 / Published in: JavaScript
 

  1. <html>
  2. <head>
  3. <script>
  4. function clickBg(e) { evt = e || window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) targ = targ.parentNode; if (targ.id == 'body') window.open('http://www.google.com/'); }
  5. </script>
  6. </head>
  7. <body onclick="clickBg(event);" id="body">
  8. <div> Some content with a <a href="http://www.google.com" target="_blank">link</a> in it.</div>
  9. </body>
  10. </html>

Report this snippet  

You need to login to post a comment.