How to write JavaScript function like prompt/confirm -
this question has answer here:
- how make function confirm 2 answers
i want write javascript function prompt() or confirm() line execution wait until mentioned function returned anything.
say, have function abc() open popup , return value. want hold execution function called.
function abc(){ ---------- return ''; } function abc_caller(){ var x = abc(); alert(x); }
can please me regarding this?
your code should -
function abc_caller(){ var x = abc(); var r=confirm("your value " + x); if (r==true) { alert("you pressed ok!") } else { alert("you pressed cancel!") } }
more examples in http://www.w3schools.com/jsref/met_win_confirm.asp.
hope you.
Comments
Post a Comment