<select id="s1" onchange="document.all.t1.value+=this.options[this.selectedIndex].value">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<select id="s2" onchange="document.all.t1.value+=this.options[this.selectedIndex].value">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<select id="s3" onchange="document.all.t1.value+=this.options[this.selectedIndex].value">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<br>
<input type="text" id="t1">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<select id="s2" onchange="document.all.t1.value+=this.options[this.selectedIndex].value">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<select id="s3" onchange="document.all.t1.value+=this.options[this.selectedIndex].value">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<br>
<input type="text" id="t1">
解决方案 »
- object text/x-scriptlet javascript 调用
- xmlhttp获取HTML(.responseText)的源代码以后能支持DOM么?
- [求大神幫助] 'undefined' 是 null 或不是一個物件..."唯獨ie8出現"
- checkbox 循环赋值(NAME和ID 均不相同的)
- asp 取值问题,从javascript中
- ext3.1 关于bbar
- 如何防止js文件被下载:我的解决方法欢迎讨论
- 谁有gis的客户端?js的,能实现放大缩小托拽等功能,能加载位图,谁有?给我一份,谢谢!
- 让表单中(form)的某一个元素不可用的脚本怎么写?
- 想问一下,哪里有类似于tab控件做的网站,帮忙推荐一下。谢谢。
- 请教如何实现弹出主界面时同时弹出其他页面,类似于打开“搜狐”时弹出的广告功能
- 用回车代替tab问题,表但都是同一名字
我把源程序贴在这里,请帮帮忙吧。
<!--本网站设计、程序、数据结构均属于耐材之窗[http://www.fm086.com]所有-->
<!-- #include file="inc/cn.asp" -->
<!-- #include file="inc/function.asp" -->
<%
response.buffer=true
%><html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
sql = "select * from compsortitem order by sort asc"
set rs3 = cn.execute(sql)
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs3.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs3("sortitem"))%>","<%= trim(rs3("sort"))%>","<%= trim(rs3("id"))%>");
<%
count = count + 1
rs3.movenext
loop
rs3.close
set rs3=nothing
%>
onecount=<%=count%>; 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>
<%sql2 = "select * from items order by sortitem asc"
set rs2 = cn.execute(sql2)
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
do while not rs2.eof
%>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("items"))%>","<%= trim(rs2("sortitem"))%>","<%= trim(rs2("id"))%>");
<%
count2 = count2 + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount2=<%=count2%>; function changelocation2(villageid)
{
document.myform.village.length = 0; var villageid=villageid;
var j;
document.myform.village.options[0] = new Option('==所选企业的项==','');
for (j=0;j < onecount2; j++)
{
if (subcat2[j][1] == villageid)
{
document.myform.village.options[document.myform.village.length] = new Option(subcat2[j][0], subcat2[j][2]);
}
} }
</script> </head>
<body>
<form name="myform" method="post">
分类:<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)" size="1">
<option selected>请选择企业的大类</option>
<% sql1 = "select * from compsort order by id asc"
set rs1 = cn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("id"))%>"><%=trim(rs1("sort"))%></option> <%
rs1.movenext
loop
rs1.close
set rs1 = nothing
cn.Close
set cn = nothing
%>
</select><select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].value)">
<option selected value="">==所有小类==</option>
</select><select name="village" size="1">
<option selected>==所有项==</option>
</select><br>
<input type="text" name="T1" size="20">
</form> </body>
</html>
要求在T1中动态显示三个下拉菜单的内容,不过楼上的贴子的意思会不会导致T1的内容不止是三个呀。
强烈要求能够解决问题的人跟一贴。
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<select id="s2" onchange="compages()"><OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<select id="s3" onchange="compages()">
<OPTION value="111">111</OPTION>
<OPTION value="222">222</OPTION>
<OPTION value="333">333</OPTION>
</select>
<br>
<input type="text" id="t1">
<script>
function compages() {
var vs1=document.all.s1.options[document.all.s1.selectedIndex].value;
var vs2=document.all.s2.options[document.all.s2.selectedIndex].value;
var vs3=document.all.s3.options[document.all.s3.selectedIndex].value;
document.all.t1.value=vs1+vs2+vs3;
}
</script>