Hidden table row probs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MATTXtwo
    New Member
    • Sep 2006
    • 83

    Hidden table row probs

    Can I hidden the selected table row like this
    Code:
    <div style="display:none;" id="CheckCountry">	
    <tr><%
    Set RS = Server.CreateObject ("ADODB.Recordset")
    rs.Open "Select Region,StateDesc FROM tblState ORDER BY StateDesc", OBJdbConnection, 3,  3
    %>
    	<td>Negeri Kelahiran</td>
    	<td colspan="3">:
    	<select id="State" name="State"> 
    	<option VALUE="N/A" SELECTED>--__________________--</option>
    	<%do while not rs.EOF
    	%>
    	<option value="<%=rs("Region")%>" <%if rs("Region")=session("Negeri_Kelahiran") then Response.Write("selected='Selected'")%>> <%=rs("StateDesc")%></option>
    	<%
    	rs.movenext
    	loop
    	rs.close
    	%>
    	</select></td>
    </tr></div>
    or is't I have to use div class....If yes..how to call css property outside this page
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi MATTXtwo,

    You can't use a div inside a table as you have done above.

    If you wish to hide the selected row then you can use the table row tags display property like this:

    Code:
    <tr style="display:none;">
    <td>This should be hidden!</td>
    </tr>
    Does this help at all?

    Dr B

    Comment

    • MATTXtwo
      New Member
      • Sep 2006
      • 83

      #3
      but i want to have it hidden and unhidden to certain occasion...
      i think ifound the solution by using css class to hide/unhide element

      Comment

      • MATTXtwo
        New Member
        • Sep 2006
        • 83

        #4
        on the <tr> I have typein the syntax
        Code:
        ").style.display = "none";
        How to change the syntax to
        Code:
        ").style.display = "block";

        Comment

        • danp129
          Recognized Expert Contributor
          • Jul 2006
          • 323

          #5
          Originally posted by MATTXtwo
          on the <tr> I have typein the syntax
          Code:
          ").style.display = "none";
          How to change the syntax to
          Code:
          ").style.display = "block";
          Code:
          <script language="javascript">
          function ToggleThisRow(rowid) {
            var row=document.getElementById(rowid);
            if (row.style.display=='none') {
              row.style.display='block';
            } else {
              row.style.display='none';
            }
          }
          </script>
          
          <input type="button" value="click to toggle" onclick="ToggleThisRow('mysometimeshiddenrow1');">
          <table>
            <tr>
              <td>always visible</td>
             </tr>
            <tr id="mysometimeshiddenrow1" style="display: none">
              <td>hidden by default</td>
            </tr>
          </table>

          Comment

          • MATTXtwo
            New Member
            • Sep 2006
            • 83

            #6
            Thanks but some logical error on my way...
            what on html event that I can do to load function on javascript...
            I mean event like onload or etc.. by doing that I can makesure some procedure to execute the hidden or unhidden the element
            Last edited by MATTXtwo; Oct 20 '08, 03:57 AM. Reason: saja jer

            Comment

            Working...