Bob Schwartz wrote:
like this in the load function?
if (!document.getElementsById) return false;
Bob
Yes, just like that. I think my favourite method (as used by PPK at
http://www.quirksmode.org/) is to use the following:
var W3CDOM = (document.createElement && document.getElementsByTagName);
if (!W3CDOM) return;
This can be used either inside a function as it is, split so that
multiple functions can call it:
var W3CDOM = (document.createElement && document.getElementsByTagName);
function doSomething() {
if (!W3CDOM) return;
}
or as part of an onload event:
var W3CDOM = (document.createElement && document.getElementsByTagName);
window.onload = function () {
if (!W3CDOM) return;
doSomething();
}
function doSomething() {
}
The same principle can be used to check for more specific things, as
with your example:
if (!document.getElementById) return;
which will stop a script if getElementById (note the singular of
Element) is not supported.
Ian.
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************