473,544 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'document is not an object' when trying to change <DIV> content

I am creating a webpage with dhtml <DIV> layers and I want a link on
one layer to modify the content on another but I seem to keep running
into errors.

Basically I create a layer in the middle of the screen that initially
comes up with a gif image of a house:

<!-- start "house" layer definition for center of screen -->
<DIV id="house" style="position :absolute; left:140px; top:137px;
width:510px; height:325px; z-index:2"><img src="images/house.gif"
width="510" height="325"></DIV>
<!-- end "house" layer definition -->

In another portion of the browser I have a navigation bar built in
another <DIV> layer that includes a number of links:

<!-- start "rtnav" layer definition for lower right navigation links
-->
<DIV id="rtnav" style="position :absolute; left:600px; top:400px;
width:200px; height:100px; z-index:13">
<SPAN id="members" class="rightnav "><a href="javascrip t:void();"
onClick="gotoMe mbers();">Membe r Login</a></SPAN>
</DIV>
<!-- end "rtnav" layer definition -->

In the <HEAD> portion, I have a <SCRIPT> section that includes the
function gotoMembers() {} that I am hoping can either use
document.write( '...'); or perhaps a load("members.h tm",800);
{preferred} to change the existing content (the gif of a house) to a
small login form:

function gotoMembers() { // pop up member dialog in blueCenter
// Example is being tested in Internet Explorer. I have also used
document.all["house"] and done
// similar testing in Netscape using document.layers["house"] without
success.

// - try using 'load' method to load an external page
// document.getEle mentById("house ").load("member s.htm",800);

// - using document.write( '...');
document.getEle mentById("house ").document.ope n();
document.getEle mentById("house ").document.wri te('this is a test, this
is only a test - please work!!!');
document.getEle mentById("house ").document.clo se();
}

Whenever I use the 'document.metho d();' it says "{node}.documen t is
not an object" where {node} is the method I used to retrieve the DIV
layer ID. I have confirmed that I can use all three constructs to
change the style.visibilit y='hidden' so it's not something else
somewhere and I have tried this in both Netscape 7.1 and Internet
Explorer Version: 6.0.2800.1106

What am I missing here?

As stated, my preference would be to load a seperate .htm file
including mark-up into the target frame "house" but none of the
document properties appear to be defined for that layer. Any help
would be appreciated.

Kathy
Jul 20 '05 #1
3 9818

"Catherine Lynn Smith" <kl*****@hotmai l.com> schreef in bericht
news:5f******** *************** ***@posting.goo gle.com...

function gotoMembers() { // pop up member dialog in blueCenter
// Example is being tested in Internet Explorer. I have also used
document.all["house"] and done
// similar testing in Netscape using document.layers["house"] without
success.

// - try using 'load' method to load an external page
// document.getEle mentById("house ").load("member s.htm",800);

// - using document.write( '...');


document.write can only be used with <layers /> in Netscape 4 when the page
is already loaded. document.getEle mentById(...).l oad(...) won't work either.

You could use an iframe instead voor Netscape 7/Mozilla and IE if you want
to include content URL based, but if you want to write to the div, you
should use its innerHTML property:

IE 4:
document.all['divID'].innerHTML = stringHTML;

IE 5+/Mozilla/Netscape 7+/Opera 7:
document.getEle mentById('divID ').innerHTML = stringHTML;
JW

Jul 20 '05 #2


In have understood well (I hope!), you'd like to change the content
of a tag div (an img) clicking another div, look if this is suitable for
you, using DOM:
<html>
<head><title>Tr y</title>
<script>
function change() {
var div = document.getEle mentById("first Div");
var old = div.childNodes[0];
var xxx = document.create Element("form") ;
var son = document.create Element("input" );
div.replaceChil d(xxx, old);
div.childNodes[0].appendChild(so n).setAttribute ("type", "text");
}
</script>
</head>
<body>
<div id="firstDiv">< img id="whatever" src="fotografie .jpg" /></div>
<div id="another"onC lick="change(); ">clickme!</div>
</body>

hope it could help you!!!

ciao

g. paolini
Jul 20 '05 #3
OK - I will try that - also, is there a way to do this by retreiving
the new content from another stand-alone html file? (e.g.
"members.ht m")

KL

son3mendo <son3mendo@_NS_ excite.it> wrote in message news:<pan.2003. 09.11.21.13.33. 419877@_NS_exci te.it>...
In have understood well (I hope!), you'd like to change the content
of a tag div (an img) clicking another div, look if this is suitable for
you, using DOM:
<html>
<head><title>Tr y</title>
<script>
function change() {
var div = document.getEle mentById("first Div");
var old = div.childNodes[0];
var xxx = document.create Element("form") ;
var son = document.create Element("input" );
div.replaceChil d(xxx, old);
div.childNodes[0].appendChild(so n).setAttribute ("type", "text");
}
</script>
</head>
<body>
<div id="firstDiv">< img id="whatever" src="fotografie .jpg" /></div>
<div id="another"onC lick="change(); ">clickme!</div>
</body>

hope it could help you!!!

ciao

g. paolini

Jul 20 '05 #4

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

Similar topics

18
4334
by: Timothy Casey | last post by:
Thanks in advance... =~= Timothy Casey South Australia worloq@iprimus.com.au Formerly: casey@smart.net.au
44
919
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to put either tag inside an HTML <TD> and have the same kind of scrolling effect. This would allow me to fill the screen and have the size of the...
4
10331
by: He Shiming | last post by:
Hi, I'm wondering how can I use <DIV> to mimic a <TABLE>. In a bare <TABLE> without a width attribute, the width of the table get dynamically expanded according to the content. However, <DIV> doesn't have the same behavior. In the CSS of the DIV tag, I have: background: #FF0000; to see the area covered by <DIV>. It appears that <DIV>...
2
3408
by: vidyasada | last post by:
Hi i m new to javascript . i need a script to srcoll the <div> content vertically within the <div> and it stops few seconds at the end of the content .. and again starts scrolling.. please anyone help.. thanks in advance, -vidya.
28
5327
by: Kent Feiler | last post by:
1. Here's some html from a W3C recommendations page. <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</DIV> 2.Although I didn't think it would make any difference, I tried it with the </p>s included as well. <P>aaaaaaaaa</p><DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</p></DIV>
4
4312
by: ontheplains | last post by:
so i need to use a mouseOver on a piece of text that is in one <div> (says "Show Me the Alternate") to make a <div> tag that has content in it move from its current spot (left: 20%), to out of the frame to the left (like left: -100%). at the same time, i need to have the <div> that was already at left: -100% move to the spot of the other, at...
5
38991
by: chakradhari.ashish | last post by:
Does anybody know how can I load an html page inside a <div</div> where the content gets update on the onclick even of anchor <a href=> </a>? I googled around and followed some links pointing me that it is possible to use javascript combined with CSS for doing this? Any ideas? Chakra
10
3181
by: Summercoolness | last post by:
so i am starting to use more of <br /and <div style="clear: both" / which is the XHTML style... now, won't those actually confuse the old browsers? for example, will the old browser treat the "div" as not closing, and so everything after the div will be treated as part of that div?
6
19262
goatboy
by: goatboy | last post by:
So I am hosting a site from my home server, and I would like the main page to be an area for updates about the site. I am providing these updates in a blog-style format, using this code: <form><fieldset> <legend>December 15, 2009</legend> <p>This is an update. Lorem ipsum, etc. etc. and so on.</p> --goatboy
0
7374
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...
0
7632
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7783
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...
0
7720
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5931
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...
1
5309
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3430
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...
1
1850
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
0
677
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...

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.