给ListBox添加双击事件示例代码
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:functionJsListChangeItem(){document.getElementById("buttonSho...
复制代码 代码如下:
<>
<script type="text/javascript">
function JsListChangeItem() {
document.getElementById("buttonShow").click();
}
</script>
<->
<asp:Button ID="buttonShow" runat="server" Text="Button"/>
<>
<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添加双击事件。
}