faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 19 people (89%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How do I find the computed dimensions of a SELECT?

Apr 20th, 2000 03:02
Martin Honnen,


NN6 and IE4+ provide the 
  offsetWidth
  offsetHeight
for this. NN4 has no comparable properties so unless you stuff your 
SELECT in a single FORM you stuff into a layer you can't measure the 
dimensions.
Here is the NN6/IE4+ example:

<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM NAME="formName">
<SELECT NAME="aSelect" 
        ONCLICK="alert(this.offsetWidth + ':' + this.offsetHeight);"
>
<OPTION>Kibology
<OPTION>Visit JavaScript.FAQTs.com for all your JavaScript Questions
</SELECT>
</FORM>
</BODY>
</HTML>