请教:如何用程序把下拉框“拉下来”?先谢谢了。 http://expert.csdn.net/Expert/TopicView2.asp?id=1219731&datebasetype=now 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果你浏览器安全级别允许的话,可以用下面的代码<select id=s1><option >1</option><option >2</option><option >3</option><option >4</option><option >5</option><option >6</option></select><input type=button id=b1 value=go onclick="aa()"><script>function aa(){ var f=new ActiveXObject("WScript.SHELL"); s1.focus(); f.SendKeys("%{DOWN}");}</script> <html><head><meta name="GENERATOR" content="Microsoft FrontPage 5.0"><meta name="ProgId" content="FrontPage.Editor.Document"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>新建网页 1</title></head><script>function downlist(thelist){ var listHtml = thelist.outerHTML; listHtml ="<select size='4' multiple id='downlist' name='downlist' onchange='changeValue(this)'></select>" var tmpList = document.createElement(listHtml); tmpList.style.position= "absolute"; tmpList.style.pixelLeft = getLeftPostion(thelist); tmpList.style.pixelTop = getTopPostion(thelist)+20; document.form1.appendChild(tmpList); for(i=0;i<thelist.length;i++){ var oOption = document.createElement('OPTION'); oOption.text = thelist.options[i].text; oOption.value =thelist.options[i].value; tmpList.options.add(oOption); }}function changeValue(the){ document.form1.D1.options[the.selectedIndex].selected=true; document.form1.removeChild(window.document.getElementById("downlist"));}function getLeftPostion( theObj ){ var pos = 0; while ( theObj != null ) { pos += theObj.offsetLeft; theObj = theObj.offsetParent; } return pos;}function getTopPostion( theObj ){ var pos = 0; while ( theObj != null ) { pos += theObj.offsetTop; theObj = theObj.offsetParent; } return pos;}</script><body><form name="form1" method="POST" action="--WEBBOT-SELF--"> <select size="1" name="D1"> <option>黄花菜1</option> <option>黄花菜2</option> <option>黄花菜3</option> <option>黄花菜4</option> </select><br> <input type="button" value="按钮" name="B1" onclick="downlist(document.form1.D1)"><input type="reset" value="重置" name="B2"></p></form></body></html> <BODY onmouseover="if (event.srcElement.tagName!='SELECT')document.all.tags('SELECT')[0].size=1"><select onmouseover="size=5;"><option>aaa<option>bbb<option>ccc<option>ddd<option>eee</select></BODY> 嘿嘿,emu你做的我看过了,好像还是我的最符合要求哦。他要求的是利用程序下拉,不定在什么时候下拉,我的方法可以随时调用那个函数,而你的方法限制就比较大了。 :) 求教.net如何导出csv文件啊??(急求) 急!!!!Extjs Combox联动的问题 邮箱快捷登陆 easyui中combobox加载数据问题 添加背景音乐 htc 文件如何模拟onclick事件 乱码问题? jquery1.10.1中文汉化版,继续我尚未完成的翻译。 如何追加事件方法 高价求购,用svg技术实现的图形化流程自定义模块! 如何取消文本框的select 一个新手的问题
<option >1</option>
<option >2</option>
<option >3</option>
<option >4</option>
<option >5</option>
<option >6</option>
</select>
<input type=button id=b1 value=go onclick="aa()">
<script>
function aa(){
var f=new ActiveXObject("WScript.SHELL");
s1.focus();
f.SendKeys("%{DOWN}");
}
</script>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<script>
function downlist(thelist)
{
var listHtml = thelist.outerHTML;
listHtml ="<select size='4' multiple id='downlist' name='downlist' onchange='changeValue(this)'></select>"
var tmpList = document.createElement(listHtml);
tmpList.style.position= "absolute";
tmpList.style.pixelLeft = getLeftPostion(thelist);
tmpList.style.pixelTop = getTopPostion(thelist)+20;
document.form1.appendChild(tmpList);
for(i=0;i<thelist.length;i++){
var oOption = document.createElement('OPTION');
oOption.text = thelist.options[i].text;
oOption.value =thelist.options[i].value;
tmpList.options.add(oOption);
}}
function changeValue(the)
{
document.form1.D1.options[the.selectedIndex].selected=true;
document.form1.removeChild(window.document.getElementById("downlist"));
}
function getLeftPostion( theObj )
{
var pos = 0;
while ( theObj != null )
{
pos += theObj.offsetLeft;
theObj = theObj.offsetParent;
}
return pos;
}
function getTopPostion( theObj )
{
var pos = 0;
while ( theObj != null )
{
pos += theObj.offsetTop;
theObj = theObj.offsetParent;
}
return pos;
}
</script>
<body><form name="form1" method="POST" action="--WEBBOT-SELF--">
<select size="1" name="D1">
<option>黄花菜1</option>
<option>黄花菜2</option>
<option>黄花菜3</option>
<option>黄花菜4</option> </select><br>
<input type="button" value="按钮" name="B1" onclick="downlist(document.form1.D1)"><input type="reset" value="重置" name="B2"></p>
</form></body></html>
<select onmouseover="size=5;">
<option>aaa
<option>bbb
<option>ccc
<option>ddd
<option>eee
</select>
</BODY>
他要求的是利用程序下拉,不定在什么时候下拉,我的方法可以随时调用那个函数,而你的方法限制就比较大了。 :)