Connecting Tech Pros Worldwide Forums | Help | Site Map

Simulating Alert / Confirm

Tony
Guest
 
Posts: n/a
#1: Jan 26 '06
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...


Evertjan.
Guest
 
Posts: n/a
#2: Jan 26 '06

re: Simulating Alert / Confirm


Tony wrote on 26 jan 2006 in comp.lang.javascript:
[color=blue]
> 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.
>
>[/color]

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)
Tony
Guest
 
Posts: n/a
#3: Jan 26 '06

re: Simulating Alert / Confirm


Evertjan. wrote:[color=blue]
> Tony wrote on 26 jan 2006 in comp.lang.javascript:
>[color=green]
> > 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.
> >
> >[/color]
>
> 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.[/color]

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...

Evertjan.
Guest
 
Posts: n/a
#4: Jan 26 '06

re: Simulating Alert / Confirm


Tony wrote on 26 jan 2006 in comp.lang.javascript:
[color=blue]
> Evertjan. wrote:[color=green]
>> Tony wrote on 26 jan 2006 in comp.lang.javascript:
>>[color=darkred]
>> > 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.
>> >
>> >[/color]
>>
>> 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.[/color]
>
> 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...[/color]

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)
Closed Thread