📄 demo-switchyesno1.aspx
字号:
<%@ Page Language="C#" %>
<script runat="server">
void page_Load()
{
if(Page.IsPostBack)
{
switch (txtIn.Text)
{
case "yes":
lblOut.Text= "Details will be sent.";
break;
case "YES":
lblOut.Text= "Details will be sent.";
break;
case "Yes":
lblOut.Text= "Details will be sent.";
break;
case "no":
lblOut.Text= "We will not contact you.";
break;
case "NO":
lblOut.Text= "We will not contact you.";
break;
case "No":
lblOut.Text= "We will not contact you.";
break;
default:
lblOut.Text = "Your answer " + txtIn.Text + " is not recognized.";
break;
} //end switch (txtIn.Text)
} //end if(Page.IsPostBack)
} //end page_Load()
</script>
<html>
<head>
</head>
<body>
<form runat="server">
Please type yes or no:
<asp:TextBox runat="server" ID="txtIn"/><br/>
<asp:Button runat="server" Text="Submit"/><br/>
<asp:Label runat="server" ID="lblOut"/><br/>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -