...

View Full Version : loading content into an object.



erin
08-21-2002, 12:55 PM
In order to load the output of an ASP/VBscript into an html page I'm using javascript.

I was wondering if and how I could load the content into a paragraph, specified <p id="para1"> ,
of a hidden iframe <iframe id="ifrm">

I tried this para1.innerHTML=document.ifrm.document.body.innerHTML;
and this
para1.innerHTML=window.frames['ifrm'].document.getElementById('theBody').innerHTML;

I'm sort of a novice in javascript. Please tell me how I can solve this problem in ie and netscape.

mordred
08-21-2002, 03:07 PM
Well, this works for me in IE5.5 and Moz 1.0:



document.getElementById("para1").innerHTML = window.frames["ifrm"].document.body.innerHTML;


This will *not* work in Netsape4.x or lower. Just because of the simple reason that older Netsape versions do not support the <iframe> tag. You'll have to resort to <layers> and the document.load method if you have to support these dead horses.

Roy Sinclair
08-21-2002, 03:08 PM
I tried this para1.innerHTML=document.ifrm.document.body.innerHTML;
and this
para1.innerHTML=window.frames['ifrm'].document.getElementById('theBody').innerHTML;


Your second attempt was close, this should work:

para1.innerHTML=window.frames['ifrm'].document.body.innerHTML;

:eek: Use Modred's solution, it's more portable.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum