SELECT Element Stays Visible After You Use Dynamic HTML to Hide a Row (828527)



The information in this article applies to:

  • Microsoft Internet Explorer 6.0 SP1

SYMPTOMS

When you try to use Dynamic HTML to hide a table row, and the table uses the COL element, if you use the SELECT element in the row, the SELECT element may be visible even though the row is hidden.

WORKAROUND

To work around this problem, you can put the SELECT element within a DIV tag that uses the "Display: None;" style. To make the SELECT element visible, use the "Display: Block;" style. The following DHTML code sample shows one way to implement these styles dynamically.
<HTML>
<HEAD>

<Script language="vbScript">
Dim Flag
Flag = true

Sub button1_OnClick()
if Flag then TableRow.style.display = "none" else TableRow.style.display = "inline"

<!-- This if statement switches between hidden and visible for the DIV tag depending on the 
     state of the Flag variable.-->

if Flag then DivTag.style.Display = "None" Else DivTag.style.Display = "Block"

Flag = not Flag
End Sub
</Script>
</HEAD>

<BODY>
<TABLE>
   <COL bgcolor="pink">
   <TR id="TableRow">
      <TD>This cell is hidden when you click the button. 
<!-- The DIV tag style depends on the value of the Flag variable. The starting value is True
     when the page first loads or is reloaded, this then will make the contents of the DIV
     tag hidden until the button is clicked. -->
         <DIV id="DivTag">
            <SELECT id=select1 name=select1>
               <OPTION>Option1</OPTION>
               <OPTION>Option2</OPTION>
            </SELECT>
         </DIV>
      </TD>
   </TR>	
</TABLE>
<INPUT type="button" value="Button" id=button1 name=button1>
</BODY>
</HTML>

STATUS

Microsoft has confirmed that this is a problem in Microsoft Internet Explorer 6.

Modification Type:MajorLast Reviewed:9/19/2003
Keywords:kbnofix kbBug KB828527 kbAudEndUser kbAudDeveloper