Dynamic Positioning In Navigator and Internet Explorer

So far, the two ways of creating layers and dynamically positioning them after a page has loaded have been covered respective to the supporting browser. So how do you create HTML pages that use layering that will work on both Netscape Navigator as well as Internet Explorer? Until both browsers support the standard that is currently being developed, both methods must be used along with some extra code to determine browser type.

Listing 5.12 merges the code from the <div> example and the code from the <layer> example. Using JavaScript to determine the type of browser, two layers (one red and another plain text) are created using either the <div> tags or the <layer> tags. The red box contains ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.