Closed Thread Icon

Preserved Topic: IFRAME question (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18016" title="Pages that link to Preserved Topic: IFRAME question (Page 1 of 1)" rel="nofollow" >Preserved Topic: IFRAME question <span class="small">(Page 1 of 1)</span>\

 
Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-22-2001 21:43

If I have an iframe, and it's ID, how can I access the window object which it contains? document.getElementById('theid') by itself doesnt do the trick, that only give me the page element of the IFRAME itself, not the window it contains.

Also, how can I set its backgound transparent?

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 05-22-2001 22:53

Slime,
I've been fightin' with these very same problems off and on for a couple of weeks now. As far as I can tell, neither is possible...
As far as can tell, the only way to reference what is inside of an IFrame is by accessing the page by it's BODY tag id.
I still haven't found a way to set bg transparent either...you can make the whole thing transparent, but not just the BG....it seems to me that IFRAME works a lot like any regular window. You can't set a browser window to be transparent...best you get is white.

mobrul

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-23-2001 09:02

Slime, you can access IFRAME using document.frames, more info here:
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/IFRAME.asp http://msdn.microsoft.com/workshop/author/dhtml/overview/inlinefloatingframes.asp

BTW Transparent IFRAMEs are only supported by IE5.5+ (and AFAIK you're using IE5)...

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 05-23-2001 11:50

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 05-23-2001 15:44

Mr. Max,
I've tried that document.frames("MyFrame").document.body.whatever
No matter what I put in for 'whatever'--style, innerHTML, etc
I get an error--"Access Denied"
What am I doing wrong?
Do I need to know something about the contained page...like it's name or id...am I missing the magic words?

mobrul

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-24-2001 01:05

Mobrul, you can access IFRAMEs only *after* the page has completely loaded...

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 05-24-2001 16:56

OK, next question then...
How can I 'know' if a page is completely loaded into an IFrame without putting an 'onLoad=whatever()' function in the pages to be loaded?
Can I access the loading/loaded status of an IFrame from the script in the ORIGINAL page?

mobrul

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-24-2001 21:02

Here's an example:

<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!-- ;
function init() {
&nbsp;&nbsp;&nbsp;&nbsp;window.frames['maxFrame'].onLoad = foo();
}
function foo() {
&nbsp;&nbsp;&nbsp;&nbsp;alert('iframe!');
&nbsp;&nbsp;&nbsp;&nbsp;window.frames['maxFrame'].document.body.style.backgroundColor = "yellow";
}
// -->
</SCRIPT>
</HEAD>
<BODY ONLOAD="init();">
<IFRAME ID="maxFrame" NAME="maxFrame" SRC="test.html" FRAMEBORDER="no" WIDTH="320" HEIGHT="240"></IFRAME>
</BODY>
</HTML>

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 05-24-2001 22:37

This is driving me f**kin' bonkers!
My code looks exactly like yours (change the names, of course), Mr. Max, and I STILL get
Access is Denied errors.
I'm running this strictly on Win IE 5.5

function checkpage(){
window.frames['frmShow0'].onLoad=alert('loaded!');
setTimeout('createDiv()','10000');
}
function createDiv(){
alert("Where is Adam?");
document.all.thebody.insertAdjacentHTML("AfterBegin","<div id='adam' style='position:absolute; top:200; left:1200; width:500; height:500; background-color:red'>adam</div>");
alert("There he is!");
document.all.adam.innerHTML = window.frames['frmShow0'].document.body.innerHTML;
alert('Finished!');
}

All but the last of the alerts work fine...out of desperation I even had checkpage() wait 10 seconds JUST to make sure that everything was loaded properly. I still get an Access is Denied error pointing at the penultimate line of script...document.all.adam.innerHTML...etc.

any help? Please?

mobrul




ShadowImage
Nervous Wreck (II) Inmate

From: Melbourne, Victoria, Australia
Insane since: Mar 2001

posted posted 05-25-2001 00:47

I think I had that problem once...Access Denied
But I only got that error when the IFRAME had a page from another site
If the page loaded in the IFRAME from another site [different domain], then you'll get the access denied error when you try to transfer the contents...i think

Hope this helps

Darkness is only the beginning

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-25-2001 12:37

Mobrul, ShadowImage is right. If the page in IFRAME is from another server, you'll get "Access is Denied" error...

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 05-25-2001 15:10

crap...double crap...
We have an intranet here for our company with information and forms and all sorts of other stuff on many servers across 3 offices in 2 different states. I was hoping to...
Oh, nevermind.
Thanks a lot for your help.
Looks like I'm going to have to stick with the IFrames.


mobrul

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-25-2001 20:33

Well, that can be *fixed* by a server-side script that will fetch the page from another server and serve it locally...

« BackwardsOnwards »

Show Forum Drop Down Menu