0

I want insert settimeout to redirect to a page

how can I do it?

this is the code:

<script>
$(document).ready(function() { var isOverAd = false;
 $( ".myframe" )
 .mouseover( function(){ isOverAd = true;} )
.mouseout( function(){ isOverAd = false;} );
 $( window ).blur( function(){ if (isOverAd){  window.location.replace("http://google.com/"); } } )
.focus();
});
</script>
elgamer
  • 1
  • 2
  • What have you tried? You already seem to have found the appropriate function. Did you read its docs? Please [edit] your question to show us. – Bergi May 26 '16 at 14:31
  • I want redirect to google.com after 5 seconds – elgamer May 26 '16 at 14:40
  • So do that. You already seem to know that you'll need to use `setTimeout`. What's the problem? Have you tried using it but it didn't work? – Bergi May 26 '16 at 17:43
  • how can I do it? I do not know how or where to put it – elgamer May 26 '16 at 18:15
  • Put it at the point where you want to schedule the action (i.e. in the if body), and put the action to be scheduled in the callback (i.e. the redirection). Did you write the code that you already have yourself? Then it should be a waltz. – Bergi May 26 '16 at 18:18
  • thanks, but, I'm not a programmer, I do not write that code, I just want to modify. can you give me a example? – elgamer May 26 '16 at 18:21
  • Maybe you should ask the guy who wrote the code for you :-) For examples, check [the docs](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout). If you want to learn how to program, we'll be able to help you, otherwise you should hire a programmer. – Bergi May 26 '16 at 18:25

0 Answers0