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