I'm looking for a method that stop excute a javascript until a onclick.
This is my script, but i don't know how to wait until a onclick.
<html>
<head>
<script type="text/javascript">
var stat = "*";
function setstat(but) {
stat = but;
}
function start() {
alert('start');
...
...
/* ??????? wait until stat != '*' ???????? */
alert(stat);
...
...
}
</script>
</head>
<body>
<input type='button' style="width: 100px;" value="Start" onclick="start();">
<br><br>
<input type='button' style="width: 100px;" value="Yes" onclick="setstat('yes')">
<input type='button' style="width: 100px;"` ``value="No" onclick="setstat('no')">`
</body>
</html>
setInterval()is what you're looking for?start() functioninto two function.First(): containing code above the line where you want to wait.Second(): containing rest of the code ofstart() function. You can callSecond()inonclickof second and thirdinputtag.