473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Try to set the ojbect of document.getElementById with a veriabled failes in FF

2 New Member
I can get this code to work in IE but not in firefox.

I have a site with 20 <div> item throughtout the site. All of the <div> tags have unique ids.

I am using an ajax call to hit a "heartbeat" page the returns a list of id names that I need to update the DIV contents.

Once the heartbeat runs this function is called.


Expand|Select|Wrap|Line Numbers
  1. function updateusage()
  2. {
  3.      if (document.getElementById('HeartBeatDIV').innerHTML != '') 
  4.       {
  5.          var updateinfodata = document.getElementById('HeartBeatDIV').innerHTML;
  6.         updateinfo = updateinfodata.split(',');
  7.      for(var i=0; i<updateinfo.length; i++){
  8.          var brickInQuestion = updateinfo[i];
  9.         var updateitembrick = document.getElementById(brickInQuestion);
  10.         updateitembrick.innerHTML = tempcontent;
  11.         updateitembrick.className  = 'brick_bought';
  12.         updateitembrick.onclick = function() {donothing()};
  13.         if (updateitembrick.style.backgroundColor != "") {
  14.             removebrick(brickInQuestion);
  15.             updateitembrick.style.backgroundColor = '';
  16.             document.getElementById('selectedbricks').innerHTML = bricksSelected;
  17.             document.getElementById('BrickDonation').innerHTML = brickdonation;
  18.             }
  19.         }
  20.      }
  21.  
  22. }
The issue is that I am seeing in the Firebug debbuging tool is

updateitembrick has no properties
[Break on this error] updateitembrick.innerHTML = tempcontent;

This works perfectly in IE but not in FF. If I change the way I am setting the updateitembrick from
Expand|Select|Wrap|Line Numbers
  1. var updateitembrick = document.getElementById(brickInQuestion);
or
Expand|Select|Wrap|Line Numbers
  1. var updateitembrick = document.getElementById('brick_1');
then FF works fine.

I am not sure what I ma missing here
Sep 7 '07 #1
2 1589
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

Show the code for HeartBeatDIV.

Did you know that you could specify a language in the code tags, e.g. [code=javascript]?
Sep 7 '07 #2
Big Guy 60
2 New Member
Welcome to TSDN!

Show the code for HeartBeatDIV.

Did you know that you could specify a language in the code tags, e.g. [code=javascript]?
The Hearbeat is a jquery script that returns a comma dilimated list of ids to a hidden DIV id "HeartBeatDIV"

a sample of the returned data is
brick_17,brick_1,brick_3
Sep 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2685
by: lawrence | last post by:
This PHP function prints out a bunch of Javascript (as you can see). This is all part of the open source weblog software of PDS (www.publicdomainsoftware.org). We had this javascript stuff...
12
3868
by: lawrence | last post by:
The following function correctly makes everything invisible but then fails to turn the one chosen DIV back to visible. I imagine I'm getting the syntax of the variable wrong? I've tried this with...
4
5441
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
7
5961
by: PaulB | last post by:
Good Morning everybody, I'm trying to adapt a tutorial script that will handle the behaviour of an "Expanding/Contracting" site-navigation menu. The code that seems to handle the expansion and...
3
9241
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...
1
36506
by: Andre Ranieri | last post by:
Hello, I'm trying to set up an ASP.NET 2.0 form where the user enters values in WebControls.TextBoxes for amount owing, interest and late fees and a JavaScript function totals the three values...
6
3356
by: therig | last post by:
I'm having issues, I've spent many hours searching and I'm a noob at javascript, any help will be greatly appreciated. I keep getting the following error: Error: document.forms.sec11_A has no...
4
2606
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
4914
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...
0
7226
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,...
0
7328
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,...
1
7049
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
7499
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
5631
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,...
1
5055
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...
0
4709
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...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.