[Javascript] make <input> field visible

Matt Barton javascript at mattbarton.org
Wed Nov 2 08:49:21 CST 2005


There's two techniques I'd suggest - the desired behaviour of your page 
would determine which you'd want to pick (and no doubt other worthies 
will send suggestions better than mine in any event).

For the purposes of this I'll assume you're changing the style settings 
of the element itself, but you could easily do as you suggest and change 
the style settngs of a div that contains the input field (and possibly 
any labels etc etc).

You could either set ...

	oObject.style.visibility = 'hidden';

... and change it to ...

	oObject.style.visibility = 'visible';

... to get it to appear.


OR...

	oObject.style.display = 'none';

.. and change it to ...

	oObject.style.display = '';

... to get it to appear.

The latter will cause the surrounding visible elements to budge-up to 
fill the space that previously held the element you've made invisible. 
The former, however, will not cause this to happen - you will get a 
blank bit of screen where the element was previously.

HTH

Matt



Michael Borchers wrote:
> i've got an input field that's supposed to be visible
> only when a certain onSelect happens.
> The onSelect event is no problem,
> but how to define the invisible input field?
>  
> using a div layer with visibilty == true etc...?!
> 
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list