can't access dynamically generated javascript function in parent frame

C

christine.nguyen

Hello all,

I have a page called test.html. Within test.html I have an iframe
whose source is mypage.html. When mypage.html loads, it dynamically
creates a javascript element which contains a function called doIt()
and attaches it to the parent page, which is test.html. I have a
button on test.html that then needs to call the dynamically attached
doIt() function. I got this to work fine on Firefox and Opera on the
Mac, but Safari is holding out on me. Any thought on this?? Any help
would be appreciated.

Thanks!
chh
 
M

Martin Honnen

I have a page called test.html. Within test.html I have an iframe
whose source is mypage.html. When mypage.html loads, it dynamically
creates a javascript element which contains a function called doIt()
and attaches it to the parent page, which is test.html. I have a
button on test.html that then needs to call the dynamically attached
doIt() function. I got this to work fine on Firefox and Opera on the
Mac, but Safari is holding out on me.

What are you doing, creating a <script> element with e.g.
document.createElement('script')
and inserting that into the document?
I think only the latest Safari 2.0.1 supports that, see
<http://webkit.opendarwin.org/blog/?p=26>
which says "Added support for loading external scripts and executing
inline scripts by dynamically adding <script> elements to the DOM."
 
C

christine.nguyen

Thanks, yes that is what I was doing. I figured out that the Safari
version I was using didn't support that. Sucks to be me....I did
figure out a way to do it though but had to take a whole different
approach.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top