Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > IE work. Firefox Does not...help

Reply
Thread Tools

IE work. Firefox Does not...help

 
 
Tmuldoon
Guest
Posts: n/a
 
      04-24-2008
Hi,

I have some Javascript that works on IE 6-7 but not Firefox(FF).

FF throws this error when clicked:

Hello,

Using Publisher 6.2 and Firefox 2.0

We have a customized Publisher template that creates some Javascript
that work fine in IE 6-7, but not FF.

FF returns this error:

Element referenced by ID/NAME in the global scope. Use W3C standard
document.getElementById() instead.
[Break on this error] undefined
(line 1)
oNug.all is not a function
[Break on this error] var e = oNug.all("disp");

How do I make it W3C compliant? Syntax help please!

Would I say var e=oNug.getElementById("disp"); ?

Why does it work with IE and not FF?

Thanks,

Tmuld
 
Reply With Quote
 
 
 
 
Holger Jeromin
Guest
Posts: n/a
 
      04-24-2008
Tmuldoon schrieb am 24.04.2008 17:08:

> I have some Javascript that works on IE 6-7 but not Firefox(FF).
>
> FF throws this error when clicked:
>
> Hello,
>
> Using Publisher 6.2 and Firefox 2.0
>
> We have a customized Publisher template that creates some Javascript
> that work fine in IE 6-7, but not FF.


We need your code for detailed analysis.

> FF returns this error:
>
> Element referenced by ID/NAME in the global scope. Use W3C standard
> document.getElementById() instead.
> [Break on this error] undefined
> (line 1)
> oNug.all is not a function
> [Break on this error] var e = oNug.all("disp");
>
> How do I make it W3C compliant? Syntax help please!
>
> Would I say var e=oNug.getElementById("disp"); ?


Try this:
var e=document.getElementById("disp");

> Why does it work with IE and not FF?


document.all is a MS invention. After that, the W3C has designed the
proper DOM functions, which were implemented by FF and MS.

--
Mit freundlichen Grüßen
Holger Jeromin
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-28-2008
Tmuldoon wrote:
> Using Publisher 6.2


Your apparently unsuitable development environment hardly matters here.

> and Firefox 2.0
>
> We have a customized Publisher template that creates some Javascript
> that work fine in IE 6-7, but not FF.
>
> FF returns this error:
>
> Element referenced by ID/NAME in the global scope. Use W3C standard
> document.getElementById() instead.
> [Break on this error] undefined
> (line 1)
> oNug.all is not a function
> [Break on this error] var e = oNug.all("disp");
>
> How do I make it W3C compliant? Syntax help please!
>
> Would I say var e=oNug.getElementById("disp"); ?


The error message indicates that `oNug' either does not refer to an object
that implements the HTMLDocument interface[1] or that Fx's Gecko is
rendering in Standards Compliance Mode. Therefore:

var e = document.getElementById("disp");
if (e)
{
// ...
}

or

var e = oNug.getElementsByName("disp");
if (e && (e = e[0]))
{
// ...
}

or, if "disp" is the name or ID of a form control within a `form' element:

var e = document.forms[zeroBasedNumberOrName].elements["disp"];

(You need to use e[zeroBasedNumber] if there is more than one control with
that name in the specified form.)

[1] http://www.w3.org/TR/DOM-Level-2-HTML/html.html

> Why does it work with IE and not FF?


Because the `all' property/method is an MSHTML-proprietary feature that is
only sparsely supported by Fx, and then in Quirks Mode only. Avoid this
feature.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
 
Reply With Quote
 
VK
Guest
Posts: n/a
 
      04-28-2008
On Apr 24, 7:08 pm, Tmuldoon <tmuld...@spliced.com> wrote:
> FF returns this error:
>
> Element referenced by ID/NAME in the global scope. Use W3C standard
> document.getElementById() instead.


Well, the error description seems very clear. Don't use
document.all("disp") and use document.getElementById("disp") instead.
What is exactly not clear here?



 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-28-2008
VK wrote:
> On Apr 24, 7:08 pm, Tmuldoon <tmuld...@spliced.com> wrote:
>> FF returns this error:
>>
>> Element referenced by ID/NAME in the global scope. Use W3C standard
>> document.getElementById() instead.

>
> Well, the error description seems very clear. Don't use
> document.all("disp") and use document.getElementById("disp") instead.
> What is exactly not clear here?


Only that the OP is not using `document.all' at the moment which causes a
standards-compliant solution to depend on the context in which the
proprietary `all' property was used before.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
 
Reply With Quote
 
GTalbot
Guest
Posts: n/a
 
      04-29-2008
On 28 avr, 10:20, VK <schools_r...@yahoo.com> wrote:

> > Element referenced by ID/NAME in the global scope. Use W3C standard
> > document.getElementById() instead.

>
> Well, the error description seems very clear. Don't use
> document.all("disp") and use document.getElementById("disp") instead.
> What is exactly not clear here?


No... not really. The OP was most likely using

var e = disp;

when in fact he should have been using

var e = document.getElementById("disp");

In IE, one can get script access to an id-ed element by simply using
its
id attribute value.
It's a very frequent error. And there are still many MSDN articles,
MSDN
code examples using the ID attribute to access elements.

Using Web Standards
Accessing Elements with the W3C DOM
http://developer.mozilla.org/en/docs...th_the_W3C_DOM

Regards, Gérard
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-29-2008
GTalbot wrote:
> On 28 avr, 10:20, VK <schools_r...@yahoo.com> wrote:
>>> Element referenced by ID/NAME in the global scope. Use W3C standard
>>> document.getElementById() instead.

>> Well, the error description seems very clear. Don't use
>> document.all("disp") and use document.getElementById("disp") instead.
>> What is exactly not clear here?

>
> No... not really. The OP was most likely using
>
> var e = disp;
>
> when in fact he should have been using
>
> var e = document.getElementById("disp");


You are mistaken. First, there is no need to speculate about the OP's code
as the offending code is already in the error message, and Firefox's
behavior is very clear here. Second, see
<news:>.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Firefox 1.5 be installed along side Firefox 1.0.6? Zygon Curry Firefox 6 09-14-2005 11:28 AM
Firefox/Linux import bookmarks from Firefox/Windows? Marek Williams Firefox 2 06-11-2005 04:22 PM
Yahoo! Toolbar Beta for Firefox - Not Compatible with Firefox 1.0.2? NA Firefox 6 04-02-2005 06:13 PM
Firefox gamed - Drudge getting around Firefox popup blocker Venger Firefox 10 12-22-2004 04:37 AM
so what does IE or any of the IE shells have over firefox ? (any anti firefox ppl bother looking at recent plugins available?) *ProteanThread* Firefox 12 10-20-2004 08:31 AM



Advertisments