Jump to content
xisto Community
Sign in to follow this  
hasan1405241478

Javascript + Css Problem passing content frm an iframe

Recommended Posts

heres the deal

i have a page with an iframe. when a link is clicked, a page is loaded in the iframe with certain text [iframe.html] . theres code in iframe.html to pass the content to a div tag [results] in the main page. heres the code

parent.document.getElementById('results').innerHTML  = document.getElementById('iframe').innerHTML;

but the text in iframe.html isnt being sent to the parent. ive tried it with window too but that didnt work either.

any help appreciated ;)

Share this post


Link to post
Share on other sites

You can't change variables you don't know about. unfortunately what you are trying doesn't work because they are two different html files. You can't set a variable between them. You should be getting javascript errors along the lines of object not found.

Share this post


Link to post
Share on other sites

i'm using the parent object. so, i can pass as many variables i want between the files. ;)btw, i got it working. i gave the content in iframe.html a div tag and used that div tag in place of iframe in the code. that way, the content passes perfectly as i want it.i'll be uploading the code to my website soon (my request was just approved) then you can see the code in action ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.