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

function won't execute twice

P: 2
Hi everybody,

I've Googled some hours now to find a solution, but I'm really stuck.

This is my situation:

I have a <div id='content'> where the content is loaded with Ajax, and some buttons outside the div. Everything works perfect.
At some time I'm loading an <iframe id='frame'> in the content-div. The iframe has a php as source wich creates a form, and loads form.js

Then from outside the content-div I execute window.form1_frame.nws_check(210,y); to call the function nws_check in form.js to check and post the form. If everything is processed, I kill the iframe with document.getElementById('content').innerHTML="" and re-use the content-div for other content.
Everything is working fine untill I create <iframe id='frame'> for a second time.

In IE7 it works perfect, calls the functions again and so on...
but in Firefox (3.0.13) I get an error:
window.form1_frame.nws_check is not a function

when I check what js is loaded when the Iframe is killed, there is no form.js
and when I load the iframe the second time, form.js is there.

when I test in form.js with if(typeof nws_check == 'function') {alert("I'm here")}
it fires the alert, so the function is there, in the same iframe as the first time, in the same div.
But still I get the error.

Any solutions?
Regards, Michel
Aug 13 '09 #1
Share this Question
Share on Google+
1 Reply


P: 2
SOLVED

it's not: window.form1_frame.nws_check(210,y)

but

var obj = document.getElementById('form1_frame')
obj.contentWindow.nws_check(210,y);
Aug 13 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.