[Javascript] Removing the Height of a DIV

Glenn E. Lanier, II glenn_lanier at netzero.net
Fri Jul 1 16:05:05 CDT 2005


I want to show/hide a div based on a radio button selection. I have everything
working somewhat, but I'd like to give the div a height of 0 when it is hidden
so I don't have a large "gap" of content.
 
JavaScript:
 
 function ShowLayer(sLayername, bShow)
 {
  if (bShow)    // Show division 
  {
   document.getElementById(sLayername).style.visibility = 'visible';
   document.getElementById(sLayername).style.height = 'auto';
  }
  else    // Hide division
  {
   document.getElementById(sLayername).style.visibility = 'hidden';
   document.getElementById(sLayername).style.height = '0';
  }
 }

ShowLayer('divPaymentOptions', false);
 
HTML:
 
<div id="divPaymentOptions">Varying content, multiple lines</div>
 
Any thoughts?
 
Thanks.
 
--G
 
  _____  

Glenn E. Lanier II

* Email:  <mailto:glenn_lanier at netzero.net> glenn_lanier at netzero.net
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050701/49121183/attachment.htm>


More information about the Javascript mailing list