aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript on Macs: document.layer and document.all Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript on Macs: document.layer and document.all" Watch "JavaScript on Macs: document.layer and document.all" New topic
Author

JavaScript on Macs: document.layer and document.all

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

First, I need to say I don't know much JavaScript. But I found a webpage that's not working in most Mac browsers, and I'm just wondering why. I think it's because of this code that starts the JavaScript...

I think I've determined that neither of these "if" blocks are executing in the Mac browsers, and this is leaving these 4 variables undefined.

I created a simple test page attempting to display the values of document.layers and document.all. Using Opera (the one Mac browser I've found that displays the page), I'm finding that document.layers is undefined, and document.all is [object HTMLCollection]. But using Safari, Camino, Firefox, and Shirra, I get nothing. In fact, Safari and Shirra seem to choke on the document.all.

So -- without knowing what "layers" and "all" mean -- is there a simple solution here? How should these variables be valued for Mac browsers?
[ June 06, 2007: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
The document.layers settings are probably what you want. I am guessing that this test differentiates Netscape browsers (which used to have something called Layers, even though that's obsolete now) from IE (document.all is an IE thing).
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
document.layers and documnet.all are um, like, um, browsers that are like 9 years old. Get rid of that code!

All you need is

document.getElementById()
or
document.forms[0]

Eric
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Eric Pascarello:
... Get rid of that code! ...

Thankfully, it's nothing I'm working on. I just ran across this and was curious about it.

Thanks for the responses!
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Hi Marc,

The good book 'HTML & XHTML The Definitive Guide' says on page #621:



Spaces and multiple columns are natural extensions to conventional HTML, existing within a document's normal flow. With version 4, Netscape took HTML into an entirely new dimension with layers. It transforms the single-element document model into one containing many layered elements that are combined to form the final document. Regrettably, layers are not supported by Netscape 6 or any other version of Internet Explorer.



Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript on Macs: document.layer and document.all