MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

js works in ie but not in firefox

  Asked By: Nadia    Date: Jan 26    Category: MOSS    Views: 1274

document.getElementById(idNam).innerHTML =
document.getElementById(idName).innerHTML.replace(oldstring, newstring);

This javascript works perfectly in ie, but it doesn't affect
anything in my firefox. I know from some other functions that Firefox can find
the elements - it just doesn't change them! What's up?



6 Answers Found

Answer #1    Answered By: Dewayne Clay     Answered On: Jan 26

First, IE is the only surefire way to support SharePoint. All others try but
they fall short in some category or another. (Not that I am a fan of IE by any
stretch; I'm a Chrome junkie.)

Second, try using jQuery instead. It's supposed to be more browser-agnostic than
straight JavaScript.

Answer #2    Answered By: Angelina Newman     Answered On: Jan 26

jQuery is an idea. But really, shouldn't javascript work the same in any
browser? Its just javascript running queries on html code...

Answer #3    Answered By: Shannon Fleming     Answered On: Jan 26

Javascript runs based on an external library provided by the browser. Each
browser has their own flavor of javascript library, just like html and css.
JQuery is better, but each browser will be somewhat different there also.

Answer #4    Answered By: Aditi Msc     Answered On: Jan 26

I figured something out. replace innerHTML does not work in Netscape
browsers for sharepoint. Instead, you must work by childnodes.

This works in IE but not in Firefox:
document.getElementById(idName).innerHTML =
document.getElementById(idName).innerHTML.replace(oldstring, newstring);
This works in both browsers:
document.getElementById(idName).childNodes[1].nodeValue =

Answer #5    Answered By: Abinav Basu     Answered On: Jan 26

Yes, jQuery is just JavaScript, *but* it is JavaScript that has been honed
and refined to take into account all sorts of browser inconsistencies.

However, in this case, I'd bet that Firefox is getting different element IDs
from the server -- unless of course your code below is copied/pasted, in
which case you appear to have a typo :)

Answer #6    Answered By: Teresa Simpson     Answered On: Jan 26

yes, I noticed the typo; no, it was actually my own typoed code... I
figured it out however. I had to select the items by nodes in certain cases to
work in firefox.

Didn't find what you were looking for? Find more on js works in ie but not in firefox Or get search suggestion and latest updates.