listener not being called

Posted by deb on Stack Overflow See other posts from Stack Overflow or by deb
Published on 2010-05-28T14:09:16Z Indexed on 2010/05/28 14:11 UTC
Read the original article Hit count: 166

Filed under:

I have a table with a button. When the button is clicked I call Modalbox.show (http://okonet.ru/projects/modalbox/) that displays a little form with another button. When the user clicks this second button, a listener is attached to an iframe in the form and the form is submitted to the server.

The server does something then it should return back to the form and execute the listener function. This works fine on IE but not in Firefox (on Firefox it never comes back).

Here it is the javascript function that is called when the user presses the second button (in the Modalbox)

function attachFile() { //window.frames['upload_iframe'].name='upload_iframe';

iframe = document.getElementById('upload_iframe');

if (iframe.addEventListener)//FF iframe.addEventListener("load", iframeEventHandler, false); if (iframe.attachEvent)//IE iframe.attachEvent("onload", iframeEventHandler);

// Set properties of form... form = document.getElementById('attchForm');

form.setAttribute("target","upload_iframe");

form.setAttribute("method","post"); form.setAttribute("enctype","multipart/form-data"); form.setAttribute("encoding","multipart/form-data");

// Submit the form... form.submit(); }

I checked that it is adding the listener but somehow does not return to it. Any hints?

Thanks

deb

© Stack Overflow or respective owner

Related posts about javascript-events