πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #54

NN6,IE5: setting DIV attribute height when undefined ?

#54
From: Veronique Quiby
Date: Tue, 09 Jan 2001 16:52
42 lines
2498 bytes
Hi,

I'm doing a project which should turn on Netscape 6 and Internet
Explorer 5.

My problem is:

I have different <div> elements and some of them should be hidden
onloading. For example:

<div id="1"> blablabla </div>
<div id="2" style="visibility:hidden"> blablabla </div>
<div id="3"> blablabla </div>
...

When my page is loaded, div id=2 is hidden. Therefore there is a hole
between div 1 and 3.
I would like to move up div id=3.
Thus I need height of div id=2 in order to assign height of div id=3 to
this value.

I don't want to calculate all the different heights (<div>).

I have tried among others this code (onloading and after loading with a
button):

var div = document.getElementsByTagName("div");
alert("Value of height for div[0]:  "+ div[0].getAttribute("height"));

There is no value on the alert window.

This let me suppose that the browser (IE and NN), after calculating the
best position for every element, don't assign the
value of attributes (that are not present in the html file). But I am
not sure.

Does somebody have an answer or alternative to my problem ?

Many thanks.

VΓ©ro
Technical Details
Message-ID: <3A5B41E3.A1122231@studi.epfl.ch>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!enews.sgi.com!news-zh.switch.ch!epflnews.epfl.ch!dinews.epfl.ch!in1sun31.epfl.ch

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10731d,fc96a9b46aa7d407,start
X-Google-Attributes: gid10731d,public
X-Google-Thread: fb3cb,fc96a9b46aa7d407,start
X-Google-Attributes: gidfb3cb,public
X-Google-Thread: fcc66,fc96a9b46aa7d407,start
X-Google-Attributes: gidfcc66,public
X-Google-Thread: ffb5d,fc96a9b46aa7d407,start
X-Google-Attributes: gidffb5d,public
X-Google-ArrivalTime: 2001-01-09 08:53:07 PST
Message-ID: <3A5B41E3.A1122231@studi.epfl.ch>
Date: Tue, 09 Jan 2001 17:52:51 +0100
From: Veronique Quiby <Veronique.Quiby@studi.epfl.ch>
X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.7 sun4u)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.lang.javascript,borland.public.intrabuilder.javascript,de.comp.lang.javascript,netscape.public.beta.feedback.javascript
Subject: NN6,IE5: setting DIV attribute height when undefined ?
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Original-NNTP-Posting-Host: in1sun31.epfl.ch
Lines: 43
NNTP-Posting-Host: disunds1.epfl.ch
X-Trace: 9 Jan 2001 17:53:02 +0200, disunds1.epfl.ch
Organization: EPFL
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!enews.sgi.com!news-zh.switch.ch!epflnews.epfl.ch!dinews.epfl.ch!in1sun31.epfl.ch