Advertisement
Guest User

Untitled

a guest
Mar 17th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.09 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. $("div").each(function() {
  22. var href = $("div").attr("onclick");
  23. $("div").removeAttr('onclick');
  24. var real_url = href.split("'");//('http://')
  25. var new_url = (real_url[1]);
  26.  
  27. $("div").click(function(event) { // when someone clicks these links
  28. setTimeout(function (){
  29.  
  30.              window.open(new_url,"_self");
  31.  
  32.          }, 5000);
  33.  // ...and open the link as usual
  34.  
  35. });
  36.  
  37. });
  38.  
  39. });
  40. </script>
  41. <a href ="http://google.com"> Google </a>
  42. <div onclick="location.href='http://yahoo.com'" >test</div>
  43.  
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement