CSDN博客

img xuandhu

例子:给下拉列表加项目

发表于2004/9/15 13:00:00  691人阅读

<html>
  <head>
    <title>第四例  根据下拉选单的内容修改文字的颜色</title>
    <script language="VB" runat="server">

 Sub Button1_Click(Sender As Object, E As EventArgs)
 
          div1.Style("color") = select1.Value

  end Sub
 Sub Button2_Click(Sender As Object, E As EventArgs)

          select1.Items.Add(text1.Value)

 end Sub

    </script>
  </head>
  <body>
 <div align=center>

    <form id="form1" runat="server" >
 
  <SELECT id="select1" runat="server">
  <OPTION>Red</OPTION>
  <OPTION>Blue</OPTION>
  <OPTION>Green</OPTION>
  </SELECT>
  <input type="button" runat="server" Value="改变控制字符的颜色"
    OnServerClick="Button1_Click" ID=Button1>
   
  <br>
  <br>
  <br>
  <input type="text" runat="server" id="text1">
  <input type="button" runat="server" Value="加入控制颜色"
   OnServerClick="Button2_Click" ID=Button2>
 
    </form>
 </div>
  <br>
  <br>
 <div id="div1" runat="server" align=center>
 <font color=<%= select1.Value%>>您选择的颜色是:
 <%= select1.Value%></font>
 </div>
 
  </body>
</html>

阅读全文
0 0

相关文章推荐

img
取 消
img