Layer (HTML tag)
Encyclopedia
Layers were the core of a method of dynamic HTML
Dynamic HTML
Dynamic HTML, or DHTML, is an umbrella term for a collection of technologies used together to create interactive and animated web sites by using a combination of a static markup language , a client-side scripting language , a presentation definition language , and the Document Object Model.DHTML...

 programming specific to Netscape 4. Each layer was treated as a separate document object in JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

. The content could be included in the same file within the non-standard
Comparison of layout engines (Non-standard HTML)
The following tables compare deprecated and proprietary HTML elements and attributes compatibility and support for a number of layout engines. Please see the individual products' articles for further information. This article is not all-inclusive or necessarily up-to-date...

 layer element (or any other element with the positioning set to "absolute" via CSS
Cascading Style Sheets
Cascading Style Sheets is a style sheet language used to describe the presentation semantics of a document written in a markup language...

) or loaded from a separate file with <layer src="URL"> or <div
Span and div
In HTML, the span and div elements are used where parts of a document cannot be semantically described by other HTML elements.Most HTML elements carry semantic meaning – i.e. the element describes, and can be made to function according to, the type of data contained within...

 src="URL">
. It could also be generated via JavaScript with the layer = new Layer constructor. The content would then be inserted into the layer with layer.document.write.

But in modern browsers, the functionality of layers is provided by using an absolutely-positioned div, or, for loading the content from an external file, an IFrame.

Irrelevant to the actual use of layers, when Netscape 4 and Internet Explorer
Internet Explorer
Windows Internet Explorer is a series of graphical web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems, starting in 1995. It was first released as part of the add-on package Plus! for Windows 95 that year...

had significantly different JavaScript implementations, a JavaScript program would very often need to run different blocks of code, depending on the browser. To decide which bunches of code to run, a JavaScript program would test for support for layers, regardless of whether the program involved layers at all. Namely,

if( document.layers ) {
...code that would be executed only by Netscape browsers...
} else {
...code that would be executed only by Internet Explorer...
}
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK