?? ex18vb.aspx
字號:
<html>
<title>第十八例 HyperLink、 Image、 DropDownList 和TextBox控件使用</title>
<head>
<script language="VB" runat="server">
Sub txtps_changed(ByVal sender As System.Object, ByVal e As System.EventArgs)
If txtname.text = "cm" And txtps.text = "991" then
'如果賬號和密碼正確,那么顯示出水果的基本資料
Label1.text="該水果的資料圖片如下"
Hyperlink1.Text = "芒果簡介"
Hyperlink1.NavigateUrl = "http://www.mago.com"
Image1.ImageUrl = "pic.jpg"
Image1.AlternateText="芒果"
Dim myList As New ArrayList()
myList.Add ("學(xué)名")
myList.Add ("產(chǎn)地簡介")
myList.Add ("食用方法")
myList.Add ("種植歷史")
myList.Add ("營養(yǎng)元素")
'在頁面上面顯示控件
Dropdownlist1.Visible=true
'制定DropDownList1的數(shù)據(jù)源是Mylist
DropDownList1.DataSource = myList
'數(shù)據(jù)綁定
DropDownList1.DataBind()
'賬號密碼有誤,清空Hyperlink1和Image1的屬性內(nèi)容,并且提示出錯信息
Else
Hyperlink1.Text = ""
Image1.ImageUrl = "m1.gif"
Label1.text="您輸入的賬號 <font color=red size=4>" & txtname.Text & "</font> 密碼 <font color=red size=4>" & txtps.Text & "</font> 有誤,重新輸入"
Return
End If
End Sub
</script>
</head>
<body>
<h3><font face="Verdana">第十八例 HyperLink、 Image、 DropDownList 和TextBox控件使用</font></h3>
<form runat="server">
請輸入您的賬號:
<asp:TextBox runat=server
id="txtname"
Text=""
Font_Face="Arial"
Font_Size="4"
BackColor="Green"
TextMode="SingleLine"
Height="25"
/>
<BR>
請輸入您的密碼:
<asp:TextBox runat=server
id="txtps"
Text=""
Font_Face="Arial"
Font_Size="4"
AutoPostBack=True
BackColor="lightblue"
TextMode="PassWord"
Height="25"
OnTextChanged="txtps_Changed"/>
<!-- 定義當(dāng)用戶輸完賬號和密碼后自動觸發(fā)的函數(shù)-->
<BR><BR>
<asp:label id="label1" runat="server"/>
<BR>
<asp:DropDownList id="DropDownList1" visible=false runat="server">
</asp:DropDownList><BR>
<asp:HyperLink id="HyperLink1" runat="server"/>
<BR>
<asp:Image id="Image1" ImageUrl = "m1.gif" AlternateText="歡迎來到水果世界" ImageAlign="left" runat="server"/>
<BR><BR>
</form>
<BR>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -