[Greasemonkey] INPUT element SIZE attribute to pixels...

Tony Chang tony at ponderer.org
Tue Jun 14 14:24:40 EDT 2005


On Tue, Jun 14, 2005 at 04:19:16PM -0400, chris feldmann wrote:

>    I've got a script that, like many greasemonkey scripts, draws a div
>    to hold some custom elements, in this case, options to populate an
>    INPUT in a form. So for aesthetic reasons, I'd like it to be the
>    same width as said input element, but I've run into the problem that
>    firefox renders the input box with a different width in pixels the
>    various platforms (linux v OSX v Win32).  I can't think of a
>    cross-platform way to translate the SIZE attribute into pixels, but
>    can anyone suggest some other ingenious way to measure an input
>    element's pixel-width?

Have you tried using getComputedStyle?
  http://www.mozilla.org/docs/dom/domref/examples.html#998756

Tony

-- 
Tony Chang
http://ponderer.org


More information about the Greasemonkey mailing list