Hi,

Thanks to your help (I think) I got the problem, but just can't solve
it:
First I have to say that my code above was more illustrative (in a
none Javascript-way ;) ), but the problem is the same.
Probably some other Javascript code (which isn't in my power to
change) catches the dom:loaded event before, so that my code is
basically ignored (on IE).

Do you have any idea how I can solve the problem?

Thanks a lot!

floce

On 31 Aug., 23:36, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> I'm not surprised to hear that. The `alert` function brings the
> JavaScript interpreter to a screeching halt and blocks darned near
> everything. But it's that "darned near" that introduces uncertainty:
> Does whatever causes the dom:loaded event on that browser queue,
> waiting for the interpreter? Or not?
>
> E.g., I think what's happening is that you're hooking the dom:loaded
> event *after* it's already fired, because you didn't hook it until
> after the `alert` returned, and the `alert` waits for the user in a
> very non-JavaScript way.
>
> Fundamentally, the browser probably _should_ queue the event, but the
> event queue is not the same as the execution queue on all browsers and
> I wouldn't rely on it. In any case, it's trivial to reverse things and
> get reliable behavior:
>
> * * * *
> document.observe("dom:loaded", function() {
>     // Some code
>     alert("bar");});
>
> alert("foo");
> * * * *
>
> You still get the "foo" alert right away, it's just that you've hooked
> the dom:loaded event beforehand and so presumably won't miss the event
> when it occurs.
>
> FWIW,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Aug 31, 5:39 pm, floce <florianzar...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I am currently facing a big problem and I hope that someone can help
> > me:
> > The following statement works perfectly in any browser except Internet
> > Explorere:
>
> > alert("foo");
> > document.observe("dom:loaded", function() {
> >     // Some code
> >     alert("bar");
>
> > });
>
> > In this case Internet Explorer would only alert "foo" but never alerts
> > "bar" while in any other browser two pop up boxes would appear. Does
> > anyone know why this happens?
>
> > Best regards,
>
> > floce- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to