<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 ("学名")
            myList.Add ("产地简介")
            myList.Add ("食用方法")
            myList.Add ("种植历史")
            myList.Add ("营养元素")
'在页面上面显示控件
	    Dropdownlist1.Visible=true
'制定DropDownList1的数据源是Mylist
            DropDownList1.DataSource = myList
'数据绑定
            DropDownList1.DataBind()
'账号密码有误，清空Hyperlink1和Image1的属性内容，并且提示出错信息
	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"/>
<!-- 定义当用户输完账号和密码后自动触发的函数-->

	<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>