<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Button1_Click(object sender, EventArgs e) { this.TextBox3.Visible = true; this.TextBox3.Text = "name " + this.TextBox1.Text; this.TextBox3.Text += "/r/n"; if (RadioButton1.Checked) { this.TextBox3.Text += "sex=男"; } else { this.TextBox3.Text += "sex=女"; } this.TextBox3.Text += "/r/n"; this.TextBox3.Text += "age="+this.TextBox2.Text; }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>無標題頁</title><script language="javascript" type="text/javascript"><!--//只允許輸入數字,不允許輸入其它字母function TextBox2_onkeypress() { //如果使用者按下斷行符號鍵,則提交表單 if(event.keyCode==13) { __doPostBack("Button1",""); } if(event.keyCode>=48 && event.keyCode<=57 ) { return true; } else { return false; } }// --></script></head><body> <form id="form1" runat="server"> <div> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" style="text-align: center"> 王瑗琿使用者註冊系統</td> </tr> <tr> <td style="width: 100px"> 姓名</td> <td style="width: 100px"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px"> 性別</td> <td style="width: 100px"> <asp:RadioButton ID="RadioButton1" Checked="true" runat="server" Text="男" /> <asp:RadioButton ID="RadioButton2" runat="server" Text="女" /></td> </tr> <tr> <td style="width: 100px"> 年齡</td> <td style="width: 100px"> <asp:TextBox ID="TextBox2" onkeypress="return TextBox2_onkeypress()" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px"> </td> <td style="width: 100px"> <asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click" /></td> </tr> <tr> <td colspan="2" style="height: 75px"> <asp:TextBox ID="TextBox3" runat="server" Height="65px" TextMode="MultiLine" Visible="False" Width="248px"></asp:TextBox></td> </tr> </table> <br /> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Width="0px"> </asp:DropDownList></div> </form></body></html>