ASP二级联动代码
我想把大类选择默认为空,也就是大类默认为<optionselectedvalue="">==请选择==</option>应该怎么加上?在那里加?按常规的加不上,小类却没事...
我想把大类选择默认为空,也就是大类默认为
<option selected value="">==请选择==</option>
应该怎么加上?在那里加?按常规的加不上,小类却没事,头疼!!
代码如下:
<!--二级联动js开始-->
<%
set rsbig=server.CreateObject("adodb.recordset")
sqlbig="select * from bigclass"
rsbig.open sqlbig,conn,1,1
set rsmin=server.CreateObject("adodb.recordset")
sqlmin="select * from minclass"
rsmin.open sqlmin,conn,1,1
%>
<SCRIPT language = "javascript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rsmin.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rsmin("minclassname"))%>","<%= trim(rsmin("bigid"))%>","<%= trim(rsmin("minID"))%>");
<%
count = count + 1
rsmin.movenext
loop
%>
onecount=<%=count%>;
function change2(locationid2)
{
document.form.minname.length = 0;
var locationid2=locationid2;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid2)
{
document.form.minname.options[document.form.minname.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<!--二级联动js结束-->
<!--选择大类-->
<form action=pai.asp method=post name="form">
<select size="1" name="bigname" onchange="change2(document.form.bigname.options[document.form.bigname.selectedIndex].value)"
<%do while not rsbig.eof%>
<option value="<%=(rsbig.Fields.Item("bigID").Value)%>"><%=(rsbig.Fields.Item("bigclassname").Value)%></option>
<%rsbig.movenext
loop%>
</select>
<!--选择小类-->
<select size="1" name="minname">
<option selected value="">==请选择==</option>
</select>
</form>
1楼的不行的,按常规加直接就不显示,我早就试过了 展开
<option selected value="">==请选择==</option>
应该怎么加上?在那里加?按常规的加不上,小类却没事,头疼!!
代码如下:
<!--二级联动js开始-->
<%
set rsbig=server.CreateObject("adodb.recordset")
sqlbig="select * from bigclass"
rsbig.open sqlbig,conn,1,1
set rsmin=server.CreateObject("adodb.recordset")
sqlmin="select * from minclass"
rsmin.open sqlmin,conn,1,1
%>
<SCRIPT language = "javascript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rsmin.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rsmin("minclassname"))%>","<%= trim(rsmin("bigid"))%>","<%= trim(rsmin("minID"))%>");
<%
count = count + 1
rsmin.movenext
loop
%>
onecount=<%=count%>;
function change2(locationid2)
{
document.form.minname.length = 0;
var locationid2=locationid2;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid2)
{
document.form.minname.options[document.form.minname.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<!--二级联动js结束-->
<!--选择大类-->
<form action=pai.asp method=post name="form">
<select size="1" name="bigname" onchange="change2(document.form.bigname.options[document.form.bigname.selectedIndex].value)"
<%do while not rsbig.eof%>
<option value="<%=(rsbig.Fields.Item("bigID").Value)%>"><%=(rsbig.Fields.Item("bigclassname").Value)%></option>
<%rsbig.movenext
loop%>
</select>
<!--选择小类-->
<select size="1" name="minname">
<option selected value="">==请选择==</option>
</select>
</form>
1楼的不行的,按常规加直接就不显示,我早就试过了 展开
1个回答
展开全部
<%
set rsbig=server.CreateObject("adodb.recordset")
sqlbig="select * from bigclass"
rsbig.open sqlbig,conn,1,1
set rsmin=server.CreateObject("adodb.recordset")
sqlmin="select * from minclass"
rsmin.open sqlmin,conn,1,1
%>
<SCRIPT language = "javascript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rsmin.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rsmin("minclassname"))%>","<%= trim(rsmin("bigid"))%>","<%= trim(rsmin("minID"))%>");
<%
count = count + 1
rsmin.movenext
loop
%>
onecount=<%=count%>;
function change2(locationid2)
{
document.form.minname.length = 0;
var locationid2=locationid2;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid2)
{
document.form.minname.options[document.form.minname.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<!--二级联动js结束-->
<!--选择大类-->
<form action=pai.asp method=post name="form">
<select size="1" name="bigname" onchange="change2(document.form.bigname.options[document.form.bigname.selectedIndex].value)">
<option value="">====请选择===</option>
<%do while not rsbig.eof%>
<option value="<%=(rsbig.Fields.Item("bigID").Value)%>"><%=(rsbig.Fields.Item("bigclassname").Value)%></option>
<%rsbig.movenext
loop%>
</select>
<!--选择小类-->
<select size="1" name="minname">
<option selected value="">==请选择==</option>
</select>
</form>
set rsbig=server.CreateObject("adodb.recordset")
sqlbig="select * from bigclass"
rsbig.open sqlbig,conn,1,1
set rsmin=server.CreateObject("adodb.recordset")
sqlmin="select * from minclass"
rsmin.open sqlmin,conn,1,1
%>
<SCRIPT language = "javascript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rsmin.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rsmin("minclassname"))%>","<%= trim(rsmin("bigid"))%>","<%= trim(rsmin("minID"))%>");
<%
count = count + 1
rsmin.movenext
loop
%>
onecount=<%=count%>;
function change2(locationid2)
{
document.form.minname.length = 0;
var locationid2=locationid2;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid2)
{
document.form.minname.options[document.form.minname.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<!--二级联动js结束-->
<!--选择大类-->
<form action=pai.asp method=post name="form">
<select size="1" name="bigname" onchange="change2(document.form.bigname.options[document.form.bigname.selectedIndex].value)">
<option value="">====请选择===</option>
<%do while not rsbig.eof%>
<option value="<%=(rsbig.Fields.Item("bigID").Value)%>"><%=(rsbig.Fields.Item("bigclassname").Value)%></option>
<%rsbig.movenext
loop%>
</select>
<!--选择小类-->
<select size="1" name="minname">
<option selected value="">==请选择==</option>
</select>
</form>
北京磐安云创科技有限公司_
2023-02-01 广告
2023-02-01 广告
价格只是购买产品或服务过程中的一项指标,如果单纯只比较价格,其实考虑并不是那么周到。价格、质量、服务、口碑、是否合适自己的情况等都需要一起考虑。以上回答如果还觉得不够详细,可以来咨询下北京磐安公司。北京磐安公司是一家专业从事高新软件的技术公...
点击进入详情页
本回答由北京磐安云创科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询