Javascript Prompt Cancel Button not “Canceling”

wallflow

New Member
I've noticed that when you have a user enter text through a \[code\]prompt\[/code\] window, the prompt will return \[code\]null\[/code\] and continue moving on with the code. I want the cancel button to do what it says it does and cancel. I've tried several \[code\]if\[/code\] statements, including:\[code\]var x= prompt("Please enter a number for <X>: (<X> + <Y>)");if (x === null) { return;}var y= prompt("Please enter a number for <Y>: (<X> + <Y>)");if (x === null) { return;} eval ("x=x; y=y; alert(+x + + y)");};\[/code\]The above does not change anything\[code\]var x= prompt("Please enter a number for <X>: (<X> + <Y>)"); if (verifyInput(false)) { return; }var y= prompt("Please enter a number for <Y>: (<X> + <Y>)"); if (verifyInput(false)) { return; }eval ("x=x; y=y; alert(+x + + y)");};\[/code\]And this one makes both the OK and Cancel buttons return false, and the code does not continue even when OK is pressed.Is their some code that will affect the Cancel button so that it stops the script from continuing? Thanks!I am very new to this website so pardon me if I didn't make myself terribly clear :)
 
Back
Top