Greetings!
I am trying to mimic the VBScript input box by creating my own InputBox() function. In this function, I will simply display a <DIV> in the middle of the screen that contains a header, a message, a text box for input, an "OK" button, and a "Cancel" button.
My problem is this. When I call the InputBox() function, I want to pause execution so that I can wait for the user to input a value into the text box. If I have the following code:
The wait command needs to suspend execution so that the alert box does not display until the user clicks ok or cancel.
I've played around with the setTimeout function, but that still allows execution to continue in the original routine.
What is the javascript method to pause execution?
Has anyone tried to do something like this before?
What are your expert ideas?
He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
I am trying to mimic the VBScript input box by creating my own InputBox() function. In this function, I will simply display a <DIV> in the middle of the screen that contains a header, a message, a text box for input, an "OK" button, and a "Cancel" button.
My problem is this. When I call the InputBox() function, I want to pause execution so that I can wait for the user to input a value into the text box. If I have the following code:
Code:
alert(InputBox("My heading", "My message"));
function InputBox(strHeading, strMessage){
//do code to set heading and message values
//do code to display <DIV>
while([ok button not pressed] && [cancel button not pressed]){
wait(3000) //<-- I need this code here!
}
return [inputed message text];
}
The wait command needs to suspend execution so that the alert box does not display until the user clicks ok or cancel.
I've played around with the setTimeout function, but that still allows execution to continue in the original routine.
What is the javascript method to pause execution?
Has anyone tried to do something like this before?
What are your expert ideas?
He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon