<div class="codetitle"> <span><a style="CURSOR: pointer" data="49836" class="copybut" id="copybut49836" onclick="doCopy('code49836')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code49836"> <br><!--创建一个JS调用button的click事件--> <br><script type="text/javascript"> <BR>function JsListChangeItem() { <br><br>document.getElementById("buttonShow").click(); <BR>} <BR></script> <br><!--创建一个隐藏的button,创建双击事件---> <br><button id="buttonShow" runat="server" onclick="buttonShow_Click" text="Button" style="display:none"></button> <br><br><!--实现双击的listbox--> <br><listbox id="listBox1" runat="server" height="226px" width="211px" autopostback="True"></listbox> <br> </div> <br>.cs <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="41550" class="copybut" id="copybut41550" onclick="doCopy('code41550')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code41550"> <br>protected void Page_Load(object sender, EventArgs e) <br>{ <br>listBox1.Attributes.Add("ondblclick", "JsListChangeItem()");//为listBox1添加双击事件。 <br>} <br> </div>