473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

The final 'document.getElementById' fix - test on old browser needed ?

Hi,

I know the 'document.getElementById()' issue is really over since every
browser since 1998 supports the W3C DOM standard, but I could not resist
this offering :-

if (!document.getElementById)
document.getElementById = function(id) { return document.all[id]; }

This should then provide a getElementById function if one does not already
exist.

Is anyone in a position to be able to test this code ?

You could go thurther and define :-

if (!document.getElementById)
if (document.all)
document.getElementById = function(id) { return
document.all[id]; }
else
document.getElementById = function(id) { return
document.layers[id]; }

Reference :-

http://www.jibbering.com/faq/faq_not...er_detect.html

Thanks,

Aaron
Jul 10 '08 #1
6 1799
* Aaron Gray wrote in comp.lang.javascript:
>I know the 'document.getElementById()' issue is really over since every
browser since 1998 supports the W3C DOM standard, but I could not resist
this offering :-

if (!document.getElementById)
document.getElementById = function(id) { return document.all[id]; }

This should then provide a getElementById function if one does not already
exist.

Is anyone in a position to be able to test this code ?
There's http://browsers.evolt.org and there are a number of free virtual
machine http://en.wikipedia.org/wiki/Categor...ation_software
products that you can use to set up old operating systems or just iso-
lated enviroments to run them.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Jul 11 '08 #2
On Jul 11, 1:21*am, "Aaron Gray" <ang.use...@gmail.comwrote:
document.getElementById = function(id) { return document.layers[id]; }
NS4 Layers are more tricky then that. Layers that are nested will not
be exposed through the top level layers array. Example

document.layers['outerLayer'].document.layers['innerLayer'] (yes, it's
that messed up)

Regards,
Svend
Jul 11 '08 #3
"Bjoern Hoehrmann" <bj****@hoehrmann.dewrote in message
news:1u********************************@hive.bjoer n.hoehrmann.de...
>* Aaron Gray wrote in comp.lang.javascript:
>>Is anyone in a position to be able to test this code ?

There's http://browsers.evolt.org and there are a number of free virtual
machine http://en.wikipedia.org/wiki/Categor...ation_software
products that you can use to set up old operating systems or just iso-
lated enviroments to run them.
I may well try this if no one comes forward to do tests for me.

Thanks,

Aaron
Jul 11 '08 #4
"Aaron Gray" <an********@gmail.comwrote in message
news:6d************@mid.individual.net...
Hi,

I know the 'document.getElementById()' issue is really over since every
browser since 1998 supports the W3C DOM standard, but I could not resist
this offering :-

if (!document.getElementById)
document.getElementById = function(id) { return document.all[id]; }

This should then provide a getElementById function if one does not already
exist.

Is anyone in a position to be able to test this code ?
There's a test for document.getElementById() emulation here :-

http://www.aarongray.org/Test/JavaSc...ById-test.html

Thanks,

Aaron
Jul 11 '08 #5
In comp.lang.javascript message <6d************@mid.individual.net>,
Fri, 11 Jul 2008 00:21:35, Aaron Gray <an********@gmail.composted:
>
I know the 'document.getElementById()' issue is really over since every
browser since 1998 supports the W3C DOM standard, but I could not resist
this offering :-

if (!document.getElementById)
document.getElementById = function(id) { return document.all[id]; }

This should then provide a getElementById function if one does not already
exist.

Is anyone in a position to be able to test this code ?
A version tested in MS IE 4 is at <URL:http://www.merlyn.demon.co.uk/js-
versn.htm#SSF>; I cannot repeat the test.

I don't recall anyone complaining that it did not work in the
circumstances in which I used it. But it does not reproduce all
features.

To get it rested in Netscape 4, I suggest that you ask the custodian of
the Davar site, who posts advertisements here from time to time.
Evidently he is keen to support those hoping to upgrade to Netscape 4.8.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 11 '08 #6
SAM
Aaron Gray a écrit :
>
There's a test for document.getElementById() emulation here :-

http://www.aarongray.org/Test/JavaSc...ById-test.html
a pure soup of tags ... !

--
sm
Jul 11 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David List | last post by:
I'm having a problem using different properties of the document object in the example javascripts in my textbook with browsers that identify themselves as using the Mozilla engine. One example of...
12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
15
by: lawrence | last post by:
Is this the correct way to test for a method before I use it? createRange() is, I believe, an IE only method. function wrapSelectionInTag(selection, tag) { if (document.selection.createRange)...
3
by: InvisibleMan | last post by:
Thanks in Advance for any help on this - its truely sending my head in loops... so I appreciate your efforts! okay, I have a javascript listed below that drops down submenus contained within:...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
19
by: vunet.us | last post by:
Hello, My AJAX application paints data into about 500 cells with unique ID every 10 seconds. I am using document.getElementById() to find the right cell. However, I have noticed that...
0
acoder
by: acoder | last post by:
Problem document.getElementById() selects an element by its name. Browser Internet Explorer Example Relevant HTML code: <input name="test" type="text" value="test"> The Javascript code:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.