Closed Thread Icon

Topic awaiting preservation: determine TD width? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8223" title="Pages that link to Topic awaiting preservation: determine TD width? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: determine TD width? <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 07-01-2002 17:22

I'd like to determine the width of two table cells by using an alert(). What would the syntax be?

alert(cellname.width);?

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 07-01-2002 18:18

Okay - I've determined that:
alert(document.getElementById('stuff').style.width);

will tell me the width that the cell SHOULD be, i.e. <td id="stuff" style="width: 150px;"> will alert me to "150px". But if, for some reason, the cell isn't actually 150 pixels wide, it still tells me 150. How can I measure the ACTUAL width (other than measuring a screen capture in PS)?

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-01-2002 18:48

document.getElementById('stuff').offsetWidth should work.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-01-2002 19:33

Also usually to get width's and other CSS data you need to call your functions grabbing the width after the page loads.



.:[ Never resist a perfect moment ]:.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 07-02-2002 20:43

Thanks, Slime - that did the trick....

« BackwardsOnwards »

Show Forum Drop Down Menu