网络编程
位置:首页>> 网络编程>> JavaScript>> 给ListBox添加双击事件示例代码

给ListBox添加双击事件示例代码

  发布时间:2024-07-12 19:53:02 

标签:ListBox,双击事件

<!--创建一个JS调用button的click事件-->
<script type="text/javascript">
function JsListChangeItem() {
document.getElementById("buttonShow").click();
}
</script>
<!--创建一个隐藏的button,创建双击事件--->
<asp:Button ID="buttonShow" runat="server" onclick="buttonShow_Click" Text="Button" style="display:none"/>
<!--实现双击的listbox-->
<asp:ListBox ID="listBox1" runat="server"Height="226px" Width="211px" AutoPostBack="True"></asp:ListBox>

.cs


protected void Page_Load(object sender, EventArgs e)
{
listBox1.Attributes.Add("ondblclick", "JsListChangeItem()");//为listBox1添加双击事件。
}
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com