有谁有比较好的能模仿组合框的select控件??

wd_318 2002-03-20 11:02:39
1、要求可以自己输入内容,或从已有选项中选取
2、如果窗口有历史网页时,按下backspace键不应该回退
...全文
89 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Reve 2002-03-20
  • 打赏
  • 举报
回复
我弄的一个MySQL查询,功能类似,你看可以否:
<html>
<head>
<title>MySQL查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<table width="625" height="95%" border="0" align="center" bgcolor="#FFCC00">
<tr>
<td height="95%" bgcolor="#FFFF00" align="center">
<div id=result style="position:relative;width:100%;height:100%;overflow:scroll;"></div>
</td>
</tr>
<tr>
<form name="MySQL" method="post" action="sqlsubmit.php" target="_submit">
<td bgcolor="#FFFF00" align="left">
<input type="hidden" name="cur_db" style="display:none;">
<input type="hidden" name="is_history" style="display:none;" value="1">
 <font style='background-color:#99FF55;color:#0000FF;'>MySQL></font><input type="text" name="query" size="75%" onkeydown="edit_input();" style="width:90%;">
</td>
</form>
</tr>
</table>
<script langugage="JavaScript">
function on_submit()
{
if(MySQL.query.value=="")
return false;
else
if(MySQL.query.value=="cls")
{
document.all.result.innerHTML="";
MySQL.query.value="";
document.all.result.scrollTop=0;
return false;
}
else
{
MySQL.is_history.value=0;
if(MySQL.query.value!=_history[_history.length-1])
{
_history[_history.length]=MySQL.query.value;
cur_index=_history.length;
MySQL.is_history.value=1;
}
else
cur_index=_history.length;
return true;
}
}
MySQL.onsubmit=on_submit;
cur_value="";
function edit_input()
{
if(window.event.keyCode==40)
{
if(MySQL.query.value!=_history[cur_index])
cur_value=MySQL.query.value;
if(cur_index<_history.length)
cur_index++;
if(cur_index==_history.length)
{
MySQL.query.value=cur_value;
MySQL.query.select();
}
else
MySQL.query.value=_history[cur_index];
}
if(window.event.keyCode==38)
{
if(MySQL.query.value!=_history[cur_index])
cur_value=MySQL.query.value;
if(cur_index>0)
cur_index--;
else
cur_index=0;
MySQL.query.value=_history[cur_index];
}
if(window.event.keyCode==27)
{
cur_index=_history.length;
MySQL.query.value="";
}
MySQL.query.focus();
}
_history=new Array(
"select * from guest",
"select * from visit limit 0,10;");
var cur_index=_history.length;
MySQL.query.focus();

function _focus()
{
MySQL.query.focus();
}
window.onfocus=_focus;

function result_blur()
{
if(window.event.keyCode<37 || window.event.keyCode>40)
MySQL.query.focus();
}
document.all.result.onkeydown=result_blur;
</script>
</body>
</html>
孟子E章 2002-03-20
  • 打赏
  • 举报
回复
http://lucky.myrice.com/temp/select.htm
8988 2002-03-20
  • 打赏
  • 举报
回复
karma(无为) 侬系弄个赚得高级五星,教教俺吧!
karma 2002-03-20
  • 打赏
  • 举报
回复
1. check it here, you might need to change a bit:
http://www.ycode.com/
2. always use location.replace(..) to load new pages
wd_318 2002-03-20
  • 打赏
  • 举报
回复
多谢karma(无为) 和各位热心朋友了!我看过www.ycode.com里的东东,
正是我所想要的。为表谢意,其他朋友请到我另一张帖里领分吧

87,994

社区成员

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

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