0

In the original Javascript is there I want this to stop it

setTimeout('open_popup()',  200);

What is function To stop this from another file js

3
  • Do you mean you want to stop the setTimeout? Commented Aug 31, 2011 at 4:02
  • 1
    stackoverflow.com/questions/3141064/… is helpful Commented Aug 31, 2011 at 4:02
  • When you put a string in setTimeout, it will be evaled. setTimeout expects a function as a first parameter, so you'll be fine just using setTimeout(open_popup, 200). Commented Aug 31, 2011 at 4:05

1 Answer 1

3

setTimeout returns a handle that you can use the clear the timeout:

var timer = setTimeout(open_popup,  200);

clearTimeout(timer);

That of course assumes you put the timer variable in a scope that is accessible to both scripts and that you clear the timeout before it fires.

Sign up to request clarification or add additional context in comments.

2 Comments

Also note that he passed the actual function to setTimeout(), and not a string to be eval()d. Using eval() (or any other function that internally eval()s code) is usually considered a bad practice. See stackoverflow.com/questions/86513/…
not work this code plz see this code i wont to stop <script type="text/javascript" src="poparb.com/grbb/code.js"></script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.