Advertisement
Guest User

Untitled

a guest
Mar 17th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.02 KB | None | 0 0
  1. <html>
  2. <head><title>test</title>
  3. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
  4. </head>
  5. <body>
  6. <script>
  7. $(document).ready(function() {
  8. $("a").each(function() {
  9. var href = $(this).attr("href");
  10. var target = $(this).attr("target");
  11. var text = $(this).text();
  12. $(this).click(function(event) { // when someone clicks these links
  13. event.preventDefault(); // don't open the link yet
  14. setTimeout(function() { // now wait 300 milliseconds...
  15. window.open(href,(!target?"_self":target)); // ...and open the link as usual
  16. },5000);
  17. });
  18. });
  19.  
  20.  
  21. jQuery('div').each(function() {
  22.     $(this).data('onClick', this.onclick);
  23.     $(this).attr('onClick', '');
  24.     $(this).click(function(event) {
  25.         window.setTimeout( function(obj) {
  26.             return function() {$(obj).data('onClick').call(obj, event || window.event)};
  27.         }(this), 5000)
  28.     });
  29. });
  30.  
  31. });
  32. </script>
  33. <a href ="http://google.com"> Google </a>
  34. <div onclick="location.href='http://yahoo.com'" >test</div>
  35.  
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement