您的位置:首页 > 编程语言 > ASP

asp:listbox双击效果实现

2014-05-12 16:14 316 查看
用js,间接实现。

<!--创建一个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>

protected void Page_Load(object sender, EventArgs e)
{
listBox1.Attributes.Add("ondblclick", "JsListChangeItem()");//为listBox1添加双击事件。
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: