Hi,

The `submit` event doesn't bubble on IE[1] (and yes, it has been 10+
years since the standard said it should[2]; what's your point? ;-) ),
so you have to watch the form, not a container of the form, so your
second script is your best bet and should work with IE *and* other
browsers.

[1] http://msdn.microsoft.com/en-us/library/aa769569(VS.85).aspx
[2] http://www.w3.org/TR/DOM-Level-2-Events/events.html

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On May 12, 9:11 pm, Junkshops <[email protected]> wrote:
> Hey guys,
>
> Thanks for the advice. I made the suggested changes, but now I've got
> a new problem - everything works fine in the good browsers, but, as
> usual, doesn't work correctly in IE8. The difference is that in IE8,
> instead of the output of the script replacing the contents of a div,
> the script output replaces the entire page. IE8 works fine when the
> listener is set directly on the form. Code for both situations is
> below. Any advice? God I hate microsoft.
>
> Thanks in advance.
>
> ______________ IE 8 chokes. The sayThanks div is loaded along with the
> form in an ajax load _____________________
>
> function initContactListener() {
>         $('centercontent').observe('submit', function(evt) { // will need
> switch logic if another form added to the center content area
>                 form = evt.findElement();
>                 $('sayThanks').update('<div style="text-align:center"><img
> src="images/ajax-loader.gif"></div>');
>                 evt.stop();
>                 new Ajax.Updater('sayThanks', form.action, {parameters:
> form.serialize()});
>         });
>
> }
>
> document.observe('dom:loaded', function() {
>         initContactListener();
>         /* removed unrelated code */
>
> });
>
> ________________ IE8 is ok - script is eval'd by prototype during an
> ajax load of the form page __________________________
>
> <script type="text/javascript">
>         var formelement = $('contactForm');
>         var sub = formelement.findFirstElement();
>         sub.focus()
>
>         formelement.observe('submit', function(evt) {
>                 $('sayThanks').update('<div style="text-align:center"><img
> src="images/ajax-loader.gif"></div>');
>                 evt.stop();
>                 new Ajax.Updater('sayThanks', this.action, {parameters:
> this.serialize()});
>         });
> </script>
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to