Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stop loop from running by clicking a button

Status
Not open for further replies.

Joost10

Technical User
Apr 27, 2004
4
NL
hello,
does anybody know how i can stop a (JavaScript) loop from running by clicking a button??
i was thinking of something like this: if(button1.onClick() )
regards
 
I haven't really used JavaScript in brio yet, but what you could do is have the loop check a (global) bool variable every time it loops, and create a button that changes the value of that variable.

while (condition) {
... program code here...

if (b_stopvariable) break;
}

button1.onClick() {
b_stopvariable = true;
}

I don't see why that wouldn't work, I can't test it, so I couldn't tell you... but give it a shot ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top