spacer
Yehuda Shiran November 26, 2000
DHTML Elements in Netscape 6
Tips: November 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

When you programmed DHTML elements in Internet Explorer and Netscape Navigator, you probably used the DIV element for the former, and the LAYER element for the latter. To change the position and visibility of a DHTML element in Internet Explorer, you probably wrote something like this in the HTML:

<DIV ID="foo" STYLE="position:absolute; left:-200; top:-100; visibility:"hidden">This is the IE foo</DIV>

and a script like this to change the element location and visibility:

document.all.foo.style.left = 200;
document.all.foo.style.top = 100;
document.all.foo.style.visibility = "visible";

Similarly, in Netscape Navigator you would use the LAYER element. You would put a line like this in the HTML page:

<LAYER NAME="foo" LEFT=-200 TOP=-100 VISIBILITY="hidden">This is the NN foo</LAYER>

and a script like this to change the element location and visibility:

document.layers.foo.left = 200;
document.layers.foo.top = 100;
document.layers.foo.visibility = "visible"

In Netscape 6, you would use the IE's HTML syntax for a DIV element:

<DIV ID="foo" STYLE="position:absolut; left:-200; top:-100; visibility:"hidden">This is the N6 foo</DIV>

but you would use the document.getElementById() method to reference this element:

document.getElementById("foo").style.left = 200;
document.getElementById("foo").style.top = 100;
document.getElementById("foo").style.visibility = "visible";


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business