1.首先将焦点给Select
2.然后模拟按键Alt+↓。模拟按键是使用ActiveX控件来完成的。
代码如下:
<Object type="application/x-oleobject" id=Shell
classid="clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B"></Object>
<SELECT id=cboSort >
<OPTION value=None selected>None</OPTION>
<OPTION value=col1>序号</OPTION>
<OPTION value=col2>抄表册</OPTION>
<OPTION value=col3>抄表册名称</OPTION>
<OPTION value=col4>抄表册性质</OPTION>
<OPTION value=col5>抄表周期</OPTION>
<OPTION value=col6>管理部门</OPTION>
<OPTION value=col7>变压器组号</OPTION>
<OPTION value=col8>变压器性质</OPTION>
<OPTION value=col9>抄表员代码</OPTION>
<OPTION value=col10>抄表员姓名</OPTION>
<OPTION value=col11>抄表列日</OPTION>
<OPTION value=col12>浮动天数</OPTION>
<OPTION value=col13>初始化标志</OPTION>
<OPTION value=col14>缴费天数</OPTION>
<OPTION value=col15>抄表方式</OPTION>
</SELECT>
<button οnclick="demo();">展开</button>
Js版
<script language= "JavaScript">
function demo(){
cboSort.focus();
var WshShell = new ActiveXObject("Wscript.Shell");
try{
WshShell.SendKeys("%{DOWN}");
}
catch(e){}
WshShell.Quit;
}
</script>
js的<Object>版
<script language= "JavaScript">
function demo2(){
cboSort.focus();
Shell.SendKeys("%{DOWN}");
Shell.Quit;
}
</script>
VB版:
<script language="VBScript">
sub demo1()
cboSort.focus()
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "%{DOWN}"
end sub
</script>