Document.all NS & Mozilla Functionality????

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

Document.all NS & Mozilla Functionality????

Postby mlibbybmwl » Sat 06 Nov, 2004 8:50 pm

Is there a way to duplicate IEs document.all functionality in Mozilla and NS? I need to retrieve a list of tag elements without knowing their IDs. For example...

Code: Select all
var frms = document.all.tags(A');
for (i=0; i<frms.length;i++)
{
     alert(frms[i].id);
}


The above example will retrieve a list of [tt]<A>[/tt] tag elements. Is there something comparable to this functionality in Netscape or Mozilla?

Mike
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
mlibbybmwl
new member
new member
 
Posts: 4
Joined: Sat 06 Nov, 2004 8:44 pm

Postby Don_HH2K » Sat 06 Nov, 2004 9:08 pm

Well, I haven't heard of [tt]document.all[/tt] functionality in IE, but my guess is that it's not standards-compliant code. If you want to fine all of the links on a page, you can right-click on the page, select "View Page Info", and click the "Links" tab. That should give you a complete list of links on a page.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (un-AXed)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Postby Fulvio » Sat 06 Nov, 2004 9:31 pm

Take a look at this: http://www.mozillazine.org/talkback.html?article=5063
or just do a search for [tt]document.all[/tt]
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041103 Firefox/1.0RC2
A minority may be right, and a majority is always wrong
~ Henrik Ibsen
WinXP, SP3, 512 MB, SM2.9.1, FF12, TB12.0.1, IE8.0, Google Chrome18, Ghostwall , Avast 7.x, JRE1.7_04. Testing FF13b3
User avatar
Fulvio
Moderator
Moderator
 
Posts: 11914
Joined: Wed 19 Jun, 2002 10:08 am

Postby mlibbybmwl » Sun 07 Nov, 2004 8:25 pm

Found it.

[tt]document.getElementsByTagName("a")[/tt]
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
mlibbybmwl
new member
new member
 
Posts: 4
Joined: Sat 06 Nov, 2004 8:44 pm

Postby Antony » Sun 07 Nov, 2004 9:33 pm

Fulvio wrote:Take a look at this: http://www.mozillazine.org/talkback.html?article=5063
or just do a search for [tt]document.all[/tt]
Thanks Fulvio for this interesting link.

An important thing to remember is that this will not break existing scripts that check for document.all, it will only work in cases where the script assumes it is running in IE, and does not first check to be sure that document.all works. If document.all is checked for, Mozilla will continue to block its use and act as it always has.

So, if the script checks for browser type, Mozilla will use the code wrote for Mozilla, sounds fair. But if the script does not check the browser type... Mozilla is to behave like MSIE. :?:

So now Mozilla is to support [tt]<marquee>[/tt], [tt]document.all[/tt] and all those used to be MSIE-only tags? When will they bring back the Communicator's [tt]<layer>[/tt] tag?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5 (KHTML, like Gecko) Safari/125.9
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Don_HH2K » Mon 08 Nov, 2004 4:30 pm

Antony wrote:When will they bring back the Communicator's [tt]<layer>[/tt] tag?

If I'm not mistaken, they have done something like that already in Netscape 7.2. I'm probably confusing this with something else, but here's an example.

1) Go into Composer, add something such as a table or image.

2) Select the object and click on the thumbtack icon in the toolbar. The object is now its own layer, and you can move it around the screen and put it in different places. You can also send it to the back of another layer or to the front.

But, besides, wasn't the LAYER tag superseded by CSS?
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Postby akbash » Mon 08 Nov, 2004 8:54 pm

In fact Netscape 7 doesn't generate a Netscape 4-style <layer> when you do that. It gives the object |position: absolute| style: CSS. The layer tag is truly dead. I can't imagine its ever resurrection.

On the other hand document.all first surfaced in a release build in September, in Firefox 1.0 PR 1. It makes me weep for besmudged purity, but it's expected to help more than it hurts. document.all is probably the single most common IE-malapropism, and I've seen actual websites, the only thing standing between them and working just fine in Firefox was pseudo-document.all as implemented in FF 1.0 PR 1. It's probably a good thing.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041108 Firefox/1.0
akbash
silver member
silver member
 
Posts: 364
Joined: Mon 09 Feb, 2004 9:13 pm

Postby Antony » Mon 08 Nov, 2004 8:58 pm

So the support of [tt]document.all[/tt] is only in Firefox :ff: (starting from version 1.0 PR), not in Mozilla ?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5 (KHTML, like Gecko) Safari/125.9
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Don_HH2K » Mon 08 Nov, 2004 9:35 pm

This was actually put in the Firefox 1.0PR release notes. From the release notes:
Image

This was also found in Bugzilla Bug 248549
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (un-AXed)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Postby akbash » Tue 09 Nov, 2004 11:28 am

Yes Firefox is the only official Mozilla release with document.all support to date. I guess that might be an important enough distinction between it and other Mozilla/Netscape browsers to keep in mind when dealing with reports of sites not working. I think it doesn't make all that much difference, though. In my limited experience, it makes an important difference at just the occasional website. Sometimes for better, sometimes not.

PS Gosh, computers on the network around Mozilla seem a little ragged this morning.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041108 Firefox/1.0
akbash
silver member
silver member
 
Posts: 364
Joined: Mon 09 Feb, 2004 9:13 pm

Postby marcoos » Wed 10 Nov, 2004 4:41 am

akbash wrote:Yes Firefox is the only official Mozilla release with document.all support to date.


Mozilla 1.8 alpha (see http://www.mozilla.org/releases/ ) supports it, too.
UserAgent: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.7.5) Gecko/20041106 Firefox/1.0
marcoos
member
member
 
Posts: 36
Joined: Fri 21 Mar, 2003 1:13 pm
Location: Poland

Postby akbash » Wed 10 Nov, 2004 3:38 pm

Well, OK. I guess 1.8 alpha could be counted as an official release. Anyway it's coming to browsers everywhere in time. Though I wouldn't hold my breath over Moz 1.7 or Netscape 7.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041108 Firefox/1.0
akbash
silver member
silver member
 
Posts: 364
Joined: Mon 09 Feb, 2004 9:13 pm


Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot], Yahoo [Bot]