By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Simulating Alert / Confirm

P: n/a
Basically, I have to find a way to hold up execution of a script while
I wait for a button to be clicked, in the same manner as alert() or
confirm() do, but without using either of those.

The basic idea is that an "alert" box is created with one or two
buttons on it, then when a button is clicked the script completes.

I've tried something like

do {
isClicked = confirmClick;
} while (!isClicked);

and the button has onclick='confirmClick=true'

but when I try this, I get an error that the javascript is taking too
long to execute & do I want to cancel it... :(

Is there any way at all to do this? I thought that using a loop like
that would do the trick, but it appears that it won't...

Jan 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Tony wrote on 26 jan 2006 in comp.lang.javascript:
Basically, I have to find a way to hold up execution of a script while
I wait for a button to be clicked, in the same manner as alert() or
confirm() do, but without using either of those.


You cannot, that is not the way js works.

Rewrite your code, so that the rest of the code is in a function executed
on pressing the relevant button.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 26 '06 #2

P: n/a
Evertjan. wrote:
Tony wrote on 26 jan 2006 in comp.lang.javascript:
Basically, I have to find a way to hold up execution of a script while
I wait for a button to be clicked, in the same manner as alert() or
confirm() do, but without using either of those.


You cannot, that is not the way js works.

Rewrite your code, so that the rest of the code is in a function executed
on pressing the relevant button.


That's what I was afraid of - I have a whole team of other developers
working on the server-side code that generates these alerts & confirms
- that's going to add a lot of extra work. I was hoping to avoid that
:(

Ah, well, I guess I should consider it job security...

Jan 26 '06 #3

P: n/a
Tony wrote on 26 jan 2006 in comp.lang.javascript:
Evertjan. wrote:
Tony wrote on 26 jan 2006 in comp.lang.javascript:
> Basically, I have to find a way to hold up execution of a script
> while I wait for a button to be clicked, in the same manner as
> alert() or confirm() do, but without using either of those.
>
>


You cannot, that is not the way js works.

Rewrite your code, so that the rest of the code is in a function
executed on pressing the relevant button.


That's what I was afraid of - I have a whole team of other developers
working on the server-side code that generates these alerts & confirms
- that's going to add a lot of extra work. I was hoping to avoid that
:(

Ah, well, I guess I should consider it job security...


It is a question of the way old programming looked at a programme as a
long line of statements, where the user was not in charge and reluctantly
was allowed to answer preformed questions, while new programming sees the
user as the one GIVING assignments to the programme by pressing a choice
of buttons.

The concept of modularity, started by abolishing the Basic "Goto"
statement, fits perfectly in this concept.

The ww-web also gives the power to the user, and the frustrated
struggling programmers on these NGs are repeatedly asking for independent
server originated actions where all actions should start from the browser
asking the server for action.

;-} / ;-{

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.