1. 程式人生 > >可控制的Select的展開與摺疊

可控制的Select的展開與摺疊

<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 onclick="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>