Link to home
Start Free TrialLog in
Avatar of m8rix
m8rixFlag for Australia

asked on

change iFrame height from child function

Can you change an iFrame height dimensions from a function with-in the child frame?

I am doing a page on my work intranet which is only updateable via an online tool which lets you write HTML (only within the <BODY> tags), but strips out any JavaScript.

I can however use small amounts of JavaScript using onload, onclick, onmouseover... elements etc...

So I have imbedded an iFrame on the page which is just a dynamic table, but because I don't know how long the table will be, it causes scrollbar to appear.

I tried to change this from the onload element of the iFrame by doing this:

<IFRAME onload="this.style.pixelHeight=this.scrollHeight;" style="OVERFLOW: auto; WIDTH: 100%;height:;" src="mytablehtml.asp" frameBorder=0></IFRAME>

But for some reason this does not work??

So I would like to include a function inside the child frame that will test how tall it is and tell it's parent to resize if possible.

*** OR ***

Would like to have my current method corrected if wrong.

Reg's
m8rix
SOLUTION
Avatar of devic
devic
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m8rix

ASKER

Thanks for your comments guys, but both of these suggestions failed. I get an access denied error
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m8rix

ASKER

Thanks for that, my two pages are on different domains :(

Is there any attributes you can get using:
document.frames.myiframe.document.body.SomeAttribute

I tried to read the innerHTML of the iFrame and got the same error.

Also, because I created the page that is included in the iFrame, can I change the security of the page somehow to allow the parent to read it?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m8rix

ASKER

Thankyou... All comments made were very good. Thus leaving behind a great reference for the future.

reg's
m8rix
thank you too!
thx :-)