Re: Re: Determining number of visible OPTIONs in a SELECT
Ian Petersen <[email protected]>
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
> I assume you are using mySelect.style.height rather than mySelect.size. Otherwise, this would
> be a moot discussion.
Exactly right.
> IE makes it really hard to work this out because it changes the font size to fit the client height of
> the select, ignoring any style properties.
I'm not sure what you mean here. I realize most styles are ignored on
OPTIONs, but what do you mean that IE changes the font size? If I
have a bunch of SELECTs on the page, each with a different
.style.height, the font size is the same on all of them, isn't it?
> I just spent about 10 minutes trying to figure out the algorithm it uses to select a font size, but
> was unable to see a pattern. If you do know the pattern (and you don't mind seeing a short blink,
> you could do this:
>
> var foo = document.getElementById('foo'); // get SELECT element
> foo.style.visibility="hidden"; // hide it while we figure this out
> foo.style.height="auto"; // ignore style.height
> var oldSize=foo.size, oldHeight=foo.style.height;
> foo.size=1; //squish to one row
> var height = foo.clientHeight; // get height of one row
> foo.size=oldSize; // restore
> foo.style.height=oldHeight;
> foo.style.visibility="visible";
> var optionHeight = IEfontFormula(foo.clientHeight, height);
This is an interesting suggestion, even though I can't implement
IEfontFormula. Couldn't I just create a SELECT of size 1, with no
borders and measure its height to figure out the height of one OPTION?
<snip>
Unfortunately I'm stuck with SELECTs and OPTIONs in this case, but a
UL would be a good choice otherwise....
> Regards,
>
> -- John
>
> http://e-numera.com/
Thanks for the response, John,
Ian
>
> --- In [email protected], Ian Petersen <ispeters@g...> wrote:
> >
> > Hello all,
> >
> > Does anyone know how to find out how many OPTION nodes are visible in
> > a given SELECT in Internet Explorer?
> >
> > In Mozilla I can ask the SELECT and one of its OPTIONs for their
> > offsetHeights and do some division, but IE always returns zero for the
> > OPTION's offsetHeight, so that won't work.
> >
> > The reason I'm asking is that I'm trying to "page" through some data,
> > and I'd like to show one list-full of list items per page. I just
> > can't figure out how many list items that is in IE.
> >
> > Thanks,
> > Ian
> >
> > --
> > Tired of pop-ups, security holes, and spyware?
> > Try Firefox: http://www.getfirefox.com
> >
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Unsubscribe
> [email protected]
>
> List info
> http://www.quirksmode.org/dom/list.html
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~->
Unsubscribe
[email protected]
List info
http://www.quirksmode.org/dom/list.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wdf-dom/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/