Js: control controls are invisible

Source: Internet
Author: User

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<TABLE>
<TR>
<TD> first column </TD>
<TD> second column </TD>
</TR>
</TABLE>
<HR>
<TABLE id = adv style = "DISPLAY: none">
<TR>
<TD> hide a table </TD>
<TD> hide a table </TD>
<TD> hide a table </TD>
</TR>
<TR>
<TD> hide a table </TD>
<TD> hide a table </TD>
<TD> hide a table </TD>
</TR>
</TABLE>
<Form name = "theForm">
<Input type = "button" NAME = "advshow" id = "advance" onclick = showadv (this) value = "show advanced user setting options">
</Form>
</BODY>
<Script language = "JavaScript">
<! --
Var isShow = false;
Function showadv (bt ){
If (isShow ){
Document. getElementById ("adv"). style. display = "none ";
Bt. value = "show advanced user setting options ";
IsShow = false;
} Else {
Document. getElementById ("adv"). style. display = "";
Bt. value = "Disable advanced user settings ";
IsShow = true;
}
}
// -->
</SCRIPT>
</HTML>

Dynamic table Generation and dynamic table Control
Stable + = "<table border = '1'> ";
For (int I = 0; I <3; I ++)
{
String btnname = "adv" + I. ToString ();
Stable + = "<tr> ";
Stable + = "<td> question: what your name? <Input type = 'button 'name = 'advshow' onclick = 'showtd (\ "" + btnname + "\") 'value = 'display question answer'/> ";
Stable + = "</td> </tr> ";
Stable + = "<tr> ";
Stable + = "<td> <table border = '1' id = '" + btnname + "'style = 'display: none'> ";
Stable + = "<tr> <td> anser: my name is kitty ";
Stable + = "</td> </tr> ";
Stable + = "</table> </td> ";

Stable + = "</tr> ";
}

Stable + = "</table> ";

<Script type = "text/javascript">

// Var isShow = false;
Function showtd (id ){
Alert ("111 ");
If (document. getElementById (id). style. display = ""){
Document. getElementById (id). style. display = "none ";
// Bt. value = "show Question Answer ";
// IsShow = false;
} Else {
Document. getElementById (id). style. display = "";
// Bt. value = "answer to your questions ";
// IsShow = true;
}
}
</Script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.