Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


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.

↑ Back to the top


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>

↑ Back to the top


Status

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

↑ Back to the top


Keywords: KB828527, kbbug, kbnofix

↑ Back to the top

Article Info
Article ID : 828527
Revision : 2
Created on : 6/20/2014
Published on : 6/20/2014
Exists online : False
Views : 170