关于页面中下拉框的问题!!!

kai_chun 2001-07-31 08:09:57
页面中的下拉框是通过<select></select>标签来实现的,可是这种标签生成的下拉框,只能选择,不能输入,有没有什么办法能够让它既能输入,又能选择?最好不用activeX,applet,单纯的通过css和html和javascript实现。
这个问题已经困扰我很久了,希望大家帮帮忙!
...全文
110 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2001-07-31
  • 打赏
  • 举报
回复
<body onload='document.a.b.focus()'>
<form name=a>
<div id=ipt style='position:absolute;left:20;top:50;visibility:visible'>
<input name=b onclick="document.all.sel.style.visibility='visible'" value="请输入">
</div>
<div id=sel style='position:absolute;left:20;top:50;visibility:hidden'>
<select>
<option>测试文字测试文字文字
<option>测试文字测试文字文字
<option>测试文字测试文字文字
<option>测试文字测试文字文字
</select>
</div>
<form>
</body>
</html>
ExitWindows 2001-07-31
  • 打赏
  • 举报
回复
up
gq 2001-07-31
  • 打赏
  • 举报
回复
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
就是这一句。你可以用javaScript将你所要生成的内容替代。。
看你怎么用了。呵呵。
gq 2001-07-31
  • 打赏
  • 举报
回复
html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;

subcat = new Array();
subcat[0] = new Array("徐汇区","01","001");
subcat[1] = new Array("嘉定区","01","002");
subcat[2] = new Array("黄浦区","01","003");
subcat[3] = new Array("南昌市","02","004");
subcat[4] = new Array("九江市","02","005");
subcat[5] = new Array("上饶市","02","006");

onecount=6;

function changelocation(locationid)
{
document.myform.smalllocation.length = 0;

var locationid=locationid;
var i;
document.myform.smalllocation.options[0] = new Option('====所有地区====','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}

}

//-->
</script>
</head>
<body>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)">
<option value="01" selected>上海</option>
<option value="02">江西</option>
</select>
<select name="smalllocation">
<option selected value="">==所有地区==</option>
</select>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value);
//-->
</script>
</body>
</html>
这段JavaScript中就包含生成select的功能。
你将其看懂应该可以解决你的问题了。
ExitWindows 2001-07-31
  • 打赏
  • 举报
回复
up
ExitWindows 2001-07-31
  • 打赏
  • 举报
回复
up

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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