我的WEB COMBO

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace xml
{
 /// <summary>
 /// WebForm4 的摘要说明。
 /// </summary>
 public class WebForm4 : System.Web.UI.Page
 {
  protected System.Web.UI.WebControls.TextBox TextBox1;
  protected System.Web.UI.WebControls.ImageButton ImageButton1;
  protected System.Web.UI.WebControls.ListBox ListBox1;
 
  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
  }

  #region Web 窗体设计器生成的代码
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {   
   this.ListBox1.SelectedIndexChanged += new System.EventHandler(this.ListBox1_SelectedIndexChanged);   
   this.Load += new System.EventHandler(this.Page_Load);

  }
  #endregion

  private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
  {
   this.TextBox1.Text = this.ListBox1.SelectedValue.ToString();
   ListBox1.Attributes.Add("onclick","javascript:hidelayer('Layer1');");   
  }

 }
}

===============================

   <%@ Page language="c#" Codebehind="WebForm4.aspx.cs" AutoEventWireup="false" Inherits="xml.WebForm4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
 <HEAD>
  <title>WebForm4</title>
  <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
  <meta content="C#" name="CODE_LANGUAGE">
  <meta content="JavaScript" name="vs_defaultClientScript">
  <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  <script language="JavaScript">
function showlayer(id){
if(navigator.appName=="Netscape")
document.layers[id].visibility="show";
else
document.all[id].style.visibility="visible";
}

function hidelayer(id){
if(navigator.appName=="Netscape")
document.layers[id].visibility="hidden";
else
document.all[id].style.visibility="hidden";
}
  </script>
 </HEAD>
 <body MS_POSITIONING="GridLayout">
  <form id="Form1" method="post" runat="server">
   &nbsp;
   <div id="Layer1" style="Z-INDEX:101; LEFT:300px; VISIBILITY:hidden; WIDTH:280px; POSITION:absolute; TOP:120px; HEIGHT:112px; BACKGROUND-COLOR:rgb(192,192,192)">
    <p><font color="#800080">这是第一层,The No.1 Layer</font><font color="#800080">
      <asp:ListBox id="ListBox1" runat="server" Width="272px" Height="96px" AutoPostBack="True">
       <asp:ListItem Value="1">1</asp:ListItem>
       <asp:ListItem Value="2">2</asp:ListItem>
       <asp:ListItem Value="3">3</asp:ListItem>
       <asp:ListItem Value="4">4</asp:ListItem>
       <asp:ListItem Value="5">5</asp:ListItem>
       <asp:ListItem Value="6">6</asp:ListItem>
       <asp:ListItem Value="7">7</asp:ListItem>
       <asp:ListItem Value="8">8</asp:ListItem>
       <asp:ListItem Value="9">9</asp:ListItem>
      </asp:ListBox></font></p>
   </div>
   <asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 304px; POSITION: absolute; TOP: 80px" runat="server"
    Width="192px"></asp:TextBox>&nbsp; <img src="CalendarDD.gif" width="15" height="15" οnclick="javascript:showlayer('Layer1');"
    style="Z-INDEX: 104; LEFT: 512px; POSITION: absolute; TOP: 80px">
  </form>
 </body>
</HTML>

  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值