473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = "contactBas e" >.

The div has a header area
<div id="contactHead er" 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="contactList er" .

Thus we have:

<DIV class = "contactBas e" >
<div id="contactHead er" class="client" >
<div id="contactList er" >

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

Within selectContact()
I successfully display the contact name with the line
document.getEle mentById('conta ctHeader').inne rHTML= contactName;

However when I then try to display the lister with
document.getEle mentById('conta ctLister').inne rHTML= listerName;

I get the error:
document.getEle mentById("conta ctLister") 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.getEle mentById('conta ctLister').inne rHTML= 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 2519
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 = "contactBas e" >.

The div has a header area
<div id="contactHead er" 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="contactList er" .

Thus we have:

<DIV class = "contactBas e" >
<div id="contactHead er" class="client" >
<div id="contactList er" >

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

Within selectContact()
I successfully display the contact name with the line
document.getEl ementById('cont actHeader').inn erHTML= contactName;

However when I then try to display the lister with
document.getEl ementById('cont actLister').inn erHTML= listerName;

I get the error:
document.getEl ementById("cont actLister") 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
2667
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 function with either MS IE 6.0 or Mozilla Firefox 0.9. Comments below indicate that if I hardcode an element ID I can avoid the error, but I...
24
9854
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 id="MyTest" style="position:absolute;top:0px;left:0;height:12;width:12;text-align:center">'+MyString+'</div>'); Now if MyString contains 6...
3
9253
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 work on FireFox or Netscape. What could be wrong? The function: function setActiveTab(tabNo) {
20
6941
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 = document.getElementById('hometab'); Has anyone ever seen anything like this before, or am I dreaming?
2
1248
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 embedded inside it when the user clicks on the link, it populates a textbox with a value specific to that link (i.e a person's ID)...I can make this...
4
6309
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. To this end I have a <divthe innerhtml for which is sent from a php file. The innerhtml constructs and fills a series of textareas and provides...
4
2618
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 iframe's src property. Being that IE does not follow standard and considers an id, name, etc as a qualifying identifier for the document.getElementById...
13
4930
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 internet. When I run Firebug on it, it says: document.getElementById("TICKER") has no properties TICKER_CONTENT =...
29
19187
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 site and so far doing this has saved about 8KB of javascript (lots of ajax/dynamic elements). I just
0
7614
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
7924
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
7974
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
6284
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...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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.