473,778 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

....[something.htm]

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

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

<script>
document.frames ("thisframe").g etElementById(" work").innerHTM L =
"goodbye"
</script>

Thank you

Jul 23 '05 #1
9 3290

<Ra*********@ho tmail.com> schreef in bericht
news:11******** ************@f1 4g2000cwb.googl egroups.com...
...[something.htm]

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

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

<script>
document.frames ("thisframe").g etElementById(" work").innerHTM L =
"goodbye"
</script>

Thank you


change to:
document.frames ("thisframe").g etElementById(" work").body.inn erHTML =

grt Bert
Jul 23 '05 #2

"Bert" <b.******@chell o.nl> schreef in bericht
news:ST******** *************@a msnews05.chello .com...

<Ra*********@ho tmail.com> schreef in bericht
news:11******** ************@f1 4g2000cwb.googl egroups.com...
...[something.htm]

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

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

<script>
document.frames ("thisframe").g etElementById(" work").innerHTM L =
"goodbye"
</script>

Thank you


change to:
document.frames ("thisframe").g etElementById(" work").body.inn erHTML =

grt Bert


sorry, makes nog sense...
Jul 23 '05 #3

<Ra*********@ho tmail.com> schreef in bericht
news:11******** ************@f1 4g2000cwb.googl egroups.com...
...[something.htm]

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

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

<script>
document.frames ("thisframe").g etElementById(" work").innerHTM L =
"goodbye"
</script>

Thank you


document.frames ("thisframe").d ocument.getElem entById("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").d ocument.getElem entById("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.javas cript only

Ra*********@hot mail.com wrote:
...[something.htm]

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

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

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


<script>
document.frames ("thisframe").g etElementById(" work").innerHTM L =
- 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.FrameNam e but not with
frames("IframeI d"). 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.getEle mentById("idIfr ame").contentDo cument

"goodbye"
</script>

Thank you

<head>
....
<script type="text/javascript">
function PopulateIframe( )
{
var IframedDocument Body = frames["thisframe"].document.body;
var FirstParg = document.create Element("p");
FirstParg.appen dChild(document .createTextNode ("goodbye")) ;
IframedDocument Body.appendChil d(FirstParg);
}
</script>
</head>

<body onload="Populat eIframe();">
....

Not tested but should work in Mozilla-based browsers.

DU
Followup-to: comp.lang.javas cript 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
9802
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 ---------------------------------------------------------------------------- -------------------------------------------- Here's how the site works: You should press a button in the rollover area in order to load a source file on an Iframe, this Iframe is actually hidden working as a Buffer. The body of this loaded Iframe is...
1
1827
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 in one iframe to open a page in a different iframe. I can do this normally: http://www.jonesmfgmusic.com/test/test1/ But, when the iframes are dynamically generated (created via a
7
4867
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+ doesn't seem to have the problem. I'm doing: this.iframe = document.createElement( 'iframe' ); this.iframe.id = this.id + 'wh'; this.iframe.style.display = 'none';
17
2649
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 directly. so I need a way doing this. so I check to see if the ifp value is null and if so then assign it a value. is this correct?
4
5141
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
618
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 hidden field in the aspx file What is the best way todo this Is it possible to add some sample code because a i have tried a lo but nothing works
26
3253
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
18292
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
52830
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 name and ID and its visible in my DOM explorer just as the table I need is it. The table is added from ASP.NET via Response.Write(). I have tried both window.frames, document.getElementById and even document.getElementsByTagName, nothing has...
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10068
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8954
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2863
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.