Reputation: 2400
I have looked around alot to find a custom prompt that will suit my purposes but am coming across a fundamental problem in most of them. I have alot of iterative JSP includes and I want to pause the execution of the web page while waiting for a response I can do this with the following code.
<script type="text/javascript">
//...
var prompt = prompt('Hello There', 'Hello Back');
var test = 5;
</script>
In this code test will not become 5 until you click ok on the prompt, but in most custom prompts I have seen test will become 5 immediately. I understand that there are complicated ways around this by modularizing code and using setTimeouts() what I am looking for though is one of two things. Is there a way to halt all execution until a dialog box is closed or is there a way to custom skin a java script alert/prompt/confirm.
Upvotes: 1
Views: 312
Reputation: 7366
Is there a way to halt all execution until a dialog box is closed
That's what you get when using alert
, confirm
or prompt
. Those are modal windows and block the execution flow.
There are no other ways to block the flow like that, see here: Stop page execution like the alert() function
or is there a way to custom skin a java script alert/prompt/confirm.
No, there isn't any way to customize the native alert boxes.
I understand that there are complicated ways around this by modularizing code
This is the only solution if you want an alert box that is both blocking, and uses a "custom skin". You should use callbacks.
Upvotes: 3