473,396 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

....[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

Jul 23 '05 #1
9 3263

<Ra*********@hotmail.com> schreef in bericht
news:11********************@f14g2000cwb.googlegrou ps.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
Jul 23 '05 #2

"Bert" <b.******@chello.nl> schreef in bericht
news:ST*********************@amsnews05.chello.com. ..

<Ra*********@hotmail.com> schreef in bericht
news:11********************@f14g2000cwb.googlegrou ps.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...
Jul 23 '05 #3

<Ra*********@hotmail.com> schreef in bericht
news:11********************@f14g2000cwb.googlegrou ps.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


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

that might be better...
Jul 23 '05 #4
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?

Jul 23 '05 #5
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?

Jul 23 '05 #6
here's the source I tested it with:


<html>

<script>
function test()
{

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

}
</script>

<body onload = "test()">
<IFRAME id="thisframe" src="./something.htm"></IFRAME>

</body>
</html>

Jul 23 '05 #7
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?

Jul 23 '05 #8
Thank you -- works perfectly... Have a great weekend! :)))

Sincerely --

Alex

Jul 23 '05 #9
DU
Followup-to: comp.lang.javascript only

Ra*********@hotmail.com wrote:
...[something.htm]

<div id=work>hello</div>
...[somethingelse.htm]

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

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


<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

"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 :)
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ----------------------------------------------------------------------------...
1
by: Malkalypse | last post by:
Hello, I have been having some trouble with this one, so I decided to strip it down to its simplest form. I think I found the root of the problem, but I don't know how to solve it. I need a link...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
17
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in...
4
by: L Anthony Johnson | last post by:
Has anyone had any success doing this. I have tried, but the InnerHTML property always comes back as an empty string. L Anthony Johnson
1
by: Jan Van Steenbergen | last post by:
Hi all i'm having a little problem I have a aspx file with a iFrame defined The iframe is loaded with a html webeditor After editing data in the webeditor textbox, i want t get the data to a...
26
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
14
by: Aaron Gray | last post by:
Hi, I want to access the properties of an IFrame but seem unable to get access to the IFrames document body. <html> <body> <iframe src="test.html" id="IFrame"></iframe> </body>
8
by: Henrik Stidsen | last post by:
I am trying to access a table in an iframe via javascript. It sounds easy - but it won´t work... The iframe is added to the document via someContainerElement.innerHTML = "<iframe...>", it has...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.