C#控件DropDownList下拉列表默认打开


c#中的控件DropDownList要实现默打开确实不容易,之前也是想过页面上的点击之后就打开了,那直接模拟点击不就行了,试过后大失所望,根本没有效果。

于是网上找到了一个例子能实现IE浏览器下的打开,具体实现看下面例子

<asp:DropDownList ID="ddlgsmc" runat="server" Height="20px" ></asp:DropDownList>

js中的代码

window.onload=function (){
                document.getElementById("ddlgsmc").focus();
                var WshShell = new ActiveXObject("Wscript.Shell");
                try {
                    WshShell.SendKeys("%{DOWN}");
                } catch (e) { }
                WshShell.Quit;
}

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM