472,954 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

baffling getElementById() has no properties error


In both IE7 and FF2(using firebug) I get the same error.

I have a page that displays work contacts' details within a
<DIV class = "contactBase" >.

The div has a header area
<div id="contactHeader" class="client" >
in which is displayed the contact's name.

Within this header area div I also want to display in smaller font
the name of the person who listed this contact.

I want to do this in <div id="contactLister" .

Thus we have:

<DIV class = "contactBase" >
<div id="contactHeader" class="client" >
<div id="contactLister" >

</div>
</div>
...
...
</DIV>
The contact is chosen from a <selectelement
(outside of these divs) which calls a
javascript function selectContact().

Within selectContact()
I successfully display the contact name with the line
document.getElementById('contactHeader').innerHTML = contactName;

However when I then try to display the lister with
document.getElementById('contactLister').innerHTML = listerName;

I get the error:
document.getElementById("contactLister") has no properties

I have placed the javascript at the bottom of the <bodybelow all the
html.
In addition I have tried placing the line
document.getElementById('contactLister').innerHTML = listerName;
in a separate function called at the end of selectContact()
but all to no avail.

I would be grateful if someone can tell me what I am doing wrong here.
TIA

N

Mar 30 '07 #1
2 2496
Lee
noddy said:
>

In both IE7 and FF2(using firebug) I get the same error.

I have a page that displays work contacts' details within a
<DIV class = "contactBase" >.

The div has a header area
<div id="contactHeader" class="client" >
in which is displayed the contact's name.

Within this header area div I also want to display in smaller font
the name of the person who listed this contact.

I want to do this in <div id="contactLister" .

Thus we have:

<DIV class = "contactBase" >
<div id="contactHeader" class="client" >
<div id="contactLister" >

</div>
</div>
...
...
</DIV>
The contact is chosen from a <selectelement
(outside of these divs) which calls a
javascript function selectContact().

Within selectContact()
I successfully display the contact name with the line
document.getElementById('contactHeader').innerHTM L= contactName;

However when I then try to display the lister with
document.getElementById('contactLister').innerHTM L= listerName;

I get the error:
document.getElementById("contactLister") has no properties
In your original HTML, contactLister is contained within contactHeader.
When you replace the contents of contactHeader by changing its innerHTML
attribute, you destroy contactLister.
--

Mar 30 '07 #2
On 29 Mar 2007 17:53:51 -0700, Lee <RE**************@cox.netwrote:
>In your original HTML, contactLister is contained within contactHeader.
When you replace the contents of contactHeader by changing its innerHTML
attribute, you destroy contactLister.
Thanks - your help is much appreciated.

N
Mar 30 '07 #3

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

Similar topics

10
by: JJA | last post by:
I'm trying to use document.getElementByID inside a function where the ID is passed as an argument. I get the same error ("Element has no properties") on the same statement inside the commonCheck...
24
by: Robi | last post by:
I have the following problem: I populate a page with a specific amount of <div id="MyTest"> containers inside another <div> container. for (i=0; i < MyString.length; i++) document.write('<div...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
2
by: CharlesA | last post by:
hi folks, I'm using the .Net framework 1.1 with ASP.net and C#: this is what I'm trying to do... I've got a repeater template working that creates a hyperlink with a javascript function call...
4
by: noddy | last post by:
I need to retrieve some notes from a database, allow users to modify them and then return them to the database.I have done this satisfactorily using php.However I would like to do it using AJAX. ...
4
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an...
13
by: RommelTJ | last post by:
Hi, My website (http://www.justiceinmexico.org/indextest.php) looks good in Firefox, but horrible in IE, and I think it's because of an error in the javascript of a free web ticker I got off the...
29
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.