请教:如何用程序把下拉框“拉下来”?先谢谢了。

zhqi 2003-02-25 05:34:07
请教:如何用程序把下拉框“拉下来”?先谢谢了。
...全文
44 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
emu_ston 2003-02-28
  • 打赏
  • 举报
回复
呵呵,我的也可以随时调用的啊
qiudehuo 2003-02-27
  • 打赏
  • 举报
回复
<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>
walkingpoison 2003-02-27
  • 打赏
  • 举报
回复
如果你浏览器安全级别允许的话,可以用下面的代码

<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>
walkingpoison 2003-02-27
  • 打赏
  • 举报
回复
嘿嘿,emu你做的我看过了,好像还是我的最符合要求哦。
他要求的是利用程序下拉,不定在什么时候下拉,我的方法可以随时调用那个函数,而你的方法限制就比较大了。 :)
emu_ston 2003-02-27
  • 打赏
  • 举报
回复
:(

我做的不好吗?
emu_ston 2003-02-27
  • 打赏
  • 举报
回复
<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>
zhqi 2003-02-26
  • 打赏
  • 举报
回复
up
zjj2002 2003-02-25
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/TopicView2.asp?id=1219731&datebasetype=now
ssm1226 2003-02-25
  • 打赏
  • 举报
回复
模拟

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧