HighDots Forums  

simple iframe, calling with innerHTML - what am i doing wrong here?

Javascript JavaScript language (comp.lang.javascript)


Discuss simple iframe, calling with innerHTML - what am i doing wrong here? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ragnorack67@hotmail.com
 
Posts: n/a

Default simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 04:50 PM






....[something.htm]

<div id=work>hello</div>


....[somethingelse.htm]

<IFRAME id="thisframe" src="./something.htm"></IFRAME>

<script>
document.frames("thisframe").getElementById("work" ).innerHTML =
"goodbye"
</script>

Thank you


Reply With Quote
  #2  
Old   
Bert
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 07:29 PM







<Ragnorack67 (AT) hotmail (DOT) com> schreef in bericht
news:1109800202.403938.5670 (AT) f14g2000cwb (DOT) googlegroups.com...
Quote:
...[something.htm]

div id=work>hello</div


...[somethingelse.htm]

IFRAME id="thisframe" src="./something.htm"></IFRAME

script
document.frames("thisframe").getElementById("work" ).innerHTML =
"goodbye"
/script

Thank you

change to:
document.frames("thisframe").getElementById("work" ).body.innerHTML =

grt Bert




Reply With Quote
  #3  
Old   
Bert
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 07:30 PM




"Bert" <b.bosch8 (AT) chello (DOT) nl> schreef in bericht
news:STsVd.254474$PH1.208537 (AT) amsnews05 (DOT) chello.com...
Quote:
Ragnorack67 (AT) hotmail (DOT) com> schreef in bericht
news:1109800202.403938.5670 (AT) f14g2000cwb (DOT) googlegroups.com...
...[something.htm]

div id=work>hello</div


...[somethingelse.htm]

IFRAME id="thisframe" src="./something.htm"></IFRAME

script
document.frames("thisframe").getElementById("work" ).innerHTML =
"goodbye"
/script

Thank you


change to:
document.frames("thisframe").getElementById("work" ).body.innerHTML =

grt Bert

sorry, makes nog sense...




Reply With Quote
  #4  
Old   
Bert
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 07:42 PM




<Ragnorack67 (AT) hotmail (DOT) com> schreef in bericht
news:1109800202.403938.5670 (AT) f14g2000cwb (DOT) googlegroups.com...
Quote:
...[something.htm]

div id=work>hello</div


...[somethingelse.htm]

IFRAME id="thisframe" src="./something.htm"></IFRAME

script
document.frames("thisframe").getElementById("work" ).innerHTML =
"goodbye"
/script

Thank you

document.frames("thisframe").document.getElementBy Id("work").innerHTML =
"goodbye";

that might be better...




Reply With Quote
  #5  
Old   
Ragnorack67@hotmail.com
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 08:56 PM



Hmm, tried both and still can't get it to work. I'm yanking my hair out
with this one. Nothing seems to work! Have you tested it out?


Reply With Quote
  #6  
Old   
Ragnorack67@hotmail.com
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 08:59 PM



Hmm, tried both and still can't get it to work. I'm yanking my hair out

with this one. Nothing seems to work! Any ideas?


Reply With Quote
  #7  
Old   
Ragnorack67@hotmail.com
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 11:06 PM



Interesting. Why does it error out if you remove test(); from body
onload? Anyway to make it a seperate call function, like <script>
test(); </script> somewhere else?


Reply With Quote
  #8  
Old   
Ragnorack67@hotmail.com
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - what am i doing wrong here? - 03-02-2005 , 11:26 PM



Thank you -- works perfectly... Have a great weekend! ))

Sincerely --

Alex


Reply With Quote
  #9  
Old   
DU
 
Posts: n/a

Default Re: simple iframe, calling with innerHTML - 03-04-2005 , 02:27 AM



Followup-to: comp.lang.javascript only

Ragnorack67 (AT) hotmail (DOT) com wrote:
Quote:
...[something.htm]

div id=work>hello</div


...[somethingelse.htm]

IFRAME id="thisframe" src="./something.htm"></IFRAME

<iframe name="thisframe" src="./something.htm"></iframe>


Quote:
script
document.frames("thisframe").getElementById("work" ).innerHTML =
- frames collection are a property of the window object, not of the
document.
- you can access a single frame within the frames collection with
frames["FrameName"] or with frames.FrameName but not with
frames("IframeId"). You're confused in the correct way to access a frame.
- when accessing a frame, the returned object is a window object, not a
document.
- contentDocument is a property of the iframe object which can return a
reference to the document contained in the iframe. So assuming:

<iframe id="idIframe" ...></iframe>

then you can access such iframed document like this:

document.getElementById("idIframe").contentDocumen t


Quote:
"goodbye"
/script

Thank you


<head>
....
<script type="text/javascript">
function PopulateIframe()
{
var IframedDocumentBody = frames["thisframe"].document.body;
var FirstParg = document.createElement("p");
FirstParg.appendChild(document.createTextNode("goo dbye"));
IframedDocumentBody.appendChild(FirstParg);
}
</script>
</head>

<body onload="PopulateIframe();">
....

Not tested but should work in Mozilla-based browsers.

DU
Followup-to: comp.lang.javascript only
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.5


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.