Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2006
    Location
    South Central, KS
    Posts
    81
    Thanks
    2
    Thanked 2 Times in 2 Posts

    getting ACTUAL width of a select box

    is there any way to find out what the "physical" width of a select is. o.style.width only returns the value set with css, i would like to know what width occures when you don't set a style (ie. allow the browser to size based on content)

    is this possible?

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Code:
    o.style.offsetWidth
    Last edited by Kor; 03-23-2007 at 08:06 AM. Reason: WRONG! offset attributes are not CSS. object.offsetWidth is the answer

  • #3
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think it might be outside the style object like

    o.offsetWidth

    although I've never used it myself. It could be browser dependent too I suppose.

    david_kw

  • #4
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Kor is right offsetWidth isn't a style attribute.. (Thanks for catching that Kor )...offsetWidth is supported by both IE and mozilla http://www.quirksmode.org/dom/getstyles.html

  • #5
    New Coder
    Join Date
    Jan 2006
    Location
    South Central, KS
    Posts
    81
    Thanks
    2
    Thanked 2 Times in 2 Posts
    i forgot to answer this...

    thanks all, it worked out fine :-D


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •