My question is closely related to
http://www.thescripts.com/forum/thread444945.html and was not answered there, so I figured I'd revive it since I think I have the same issue.
Here is my applicable code:
-
do {
-
var f=prompt('Would you like the output to be displayed in this page (1) or as a pop-up (2)','1');
-
}
-
while (f != "1" && f != "2" && f != "");
-
-
// Begin case statement to make the code do its stuff based on "f"
Basically I want the prompt to get the user to have to put in either a 1 or a 2 no matter what, unless they hit Cancel. That means if they erase my "1" I have in there by default and they leave the prompt blank and they hit OK, I want it to spit the prompt back at them. The code above works great for that except the Cancel will just make the box stay up. I know that it's because of my f != "" above (the element that checks to see if the box was left blank), but is there a way to distinguish between when f happens to be null from being left blank (f's value is actually "undefined") and when the Cancel button was pressed (when f's value is "null")? Is there actually a difference? Using f !="null" above does not work, either.
Thanks,
Tom