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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint