views:

252

answers:

2

Hi,

I have used innerHtml in my java based web application. JavaScript works fine with Mozilla Firefox but it is not working in InternetExplorer.

Could you please tell me how to make it work in Internet Explorer too. or what is substitute of innerHTML in IE.

Code is:

function show() {    
  if('number' == typeof this.rowIndex) {
    var rn = this.rowIndex;
    var cell = tableRows[rn].cells;
    employeeCode = cell[0].innerHTML;
    //..........
  }
}

Thank and regards

A: 

innerHTML works in IE. Can you post the code that is not working, so we can take a look?

Kevin
Here is code i am using:function show() { if('number' == typeof this.rowIndex) { var rn=this.rowIndex; var cell = tableRows[rn].cells; employeeCode=cell[0].innerHTML; ...... ...... ...... }}
+6  A: 

Using jQuery eliminates problems like this in nearly all cases. It handles the minor differences between major browsers so you can do simple things like:

$("div.summary").html(); /* Gets HTML from <div class="summary"> */
$("div.summary").html("Hello"); /* Sets the HTML */
Jonathan Sampson
Don't forget the setter.
Chris Doggett
Just goes to show you, the answer is always "use jQuery".
William Brendel
I wouldn't say "always," but certainly most of the time :)
Jonathan Sampson
@Jonathan: It's a running joke, that's all. I know it's not "always" the answer :-)
William Brendel
@William, Ah, sorry :)
Jonathan Sampson