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=";" 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.

LVL 10
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

<IFRAME name=myiframe onload=";"
style="OVERFLOW: auto; WIDTH: 100%;height:;" src="child.html" frameBorder=0></IFRAME>
you can detect the iframe height in a child and resize it, eg

<IFRAME id="f" src="child.htm ">

then in child.htm

<input type="button" onclick="if (parent.document.getElementById('f').height < 250) parent.document.getElementById('f').height=300">
m8rixAuthor Commented:
Thanks for your comments guys, but both of these suggestions failed. I get an access denied error
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

you can not change iframe, if the iframe is not in the same domain
m8rixAuthor Commented:
Thanks for that, my two pages are on different domains :(

Is there any attributes you can get using:

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?
no way and forget all what beginns with "document." on foreign domain, because it's not your document.

you can use XMLHTTP:
<body onload=init()>

<center><h2>hello m8rix!</h2></center>
function LoadPage(theURL,theID)

   var objSrvHTTP;
       objSrvHTTP = new ActiveXObject("Msxml2.XMLHTTP.4.0"); ("GET",theURL,false);
       objSrvHTTP.send ("");



function init()
<table width=555 cellspacing=0 cellpadding=0 border=3>
      <td valign=top id=yahoo></td>
      <td valign=top id=ebay></td>


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
m8rixAuthor Commented:
Thankyou... All comments made were very good. Thus leaving behind a great reference for the future.

thank you too!
thx :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.