Pow
Pow

Reputation: 1367

Browser Compatibility of innerHTML

I have a simple function to refresh a table. It simply creates a table in a div. It works fine in safari and chrome. But for some reason it is not working in firefox. Can anyone suggest me some alternative of this so that it works in firefox as well?

Here's my code -

function tableRefresh(){
     POIdiv.innerHTML=" <table id='POITable' border='1' > <tr><td>POI</td><td>Latitude</td><td>Longitude</td><td>Delete?</td></tr><tr  id='tr1'><td id='poinum'>1</td><td><input size=25 type='text' id='latbox' readonly=true/></td><td><input size=25 type='text' id='lngbox' readonly=true/></td><td><input type='button' id=1 value='Delete' onclick='deleteRow_addPOI(this.id)'/></td></tr></table>";
     }    

This function is called under a button's onclick event.

::::::::::EDIT:::::::::::::

Please try the following link -

http://128.233.104.33/passgui/editLeveledit.php?dbname=reganTest3

Now do these -

  1. click on map to add some points
  2. click on "Add the new POIs"

It should upgrade both the tables. Please try it in Google Chore/ Safari first then try it in Firefox. You can find the difference.

Thanks

Upvotes: 2

Views: 1653

Answers (2)

Joe
Joe

Reputation: 15812

Change

POIdiv.innerHTML=...

to

document.getElementById('POIdiv').innerHTML=...

Upvotes: 1

Dave Newton
Dave Newton

Reputation: 160291

Define "not work"; it works fine for me on my jsfiddle test in Firefox, with a slight modification since we don't know how you're setting/getting the POIdiv variable.

Upvotes: 1

Related Questions