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