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
- function updateusage()
- {
- if (document.getElementById('HeartBeatDIV').innerHTML != '')
- {
- var updateinfodata = document.getElementById('HeartBeatDIV').innerHTML;
- updateinfo = updateinfodata.split(',');
- for(var i=0; i<updateinfo.length; i++){
- var brickInQuestion = updateinfo[i];
- var updateitembrick = document.getElementById(brickInQuestion);
- updateitembrick.innerHTML = tempcontent;
- updateitembrick.className = 'brick_bought';
- updateitembrick.onclick = function() {donothing()};
- if (updateitembrick.style.backgroundColor != "") {
- removebrick(brickInQuestion);
- updateitembrick.style.backgroundColor = '';
- document.getElementById('selectedbricks').innerHTML = bricksSelected;
- document.getElementById('BrickDonation').innerHTML = brickdonation;
- }
- }
- }
- }
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
- var updateitembrick = document.getElementById(brickInQuestion);
Expand|Select|Wrap|Line Numbers
- var updateitembrick = document.getElementById('brick_1');
I am not sure what I ma missing here