ASP三级级联动改二级联动
<%setrs=conn.execute("select*fromchina_citywhereid>0andtwoid=0")ifrs.eoforrs.bofthenr...
<%set rs=conn.execute("select * from china_city where id>0 and twoid=0")
if rs.eof or rs.bof then
response.write "<option value=''>没有分类</option>"
else
do until rs.eof
response.write "<option value='"&rs("id")&"'>"&rs("city")&"</option>"
rs.movenext
loop
end if
rs.close
set rs = nothing%></select> 展开
if rs.eof or rs.bof then
response.write "<option value=''>没有分类</option>"
else
do until rs.eof
response.write "<option value='"&rs("id")&"'>"&rs("city")&"</option>"
rs.movenext
loop
end if
rs.close
set rs = nothing%></select> 展开
展开全部
<html>
<head>
</head>
<script language='javascript'>
var teArray=new Array();
var steArray=new Array();
teArray[teArray.length]=new Array("1","国际新");
steArray[steArray.length]=new Array("1","4","八卦新闻");
steArray[steArray.length]=new Array("1","5","娱乐新闻");
teArray[teArray.length]=new Array("2","国内新闻");
steArray[steArray.length]=new Array("2","7","国际八卦");
teArray[teArray.length]=new Array("3","八卦新闻");
teArray[teArray.length]=new Array("6","国际娱乐");
function cc(c){
var te=null;
var type=[];
te=document.getElementById(c);
type=te.options;
for(i=0;i<teArray.length;i++){
type.add(new Option(teArray[i][1],teArray[i][0]));
}
}
function dd(d,c){
var ste=null;
var subtype=[];
ste=document.getElementById(d);
subtype=ste.options;
te_value=document.getElementById(c).value
// for(i=0;i<=subtype.length;i++){
for(i=subtype.length;i>=0;i--){
subtype.options[i]=null;
subtype.remove(i);
}
for(i=0;i<steArray.length;i++){
if(steArray[i][0]==te_value){
subtype.add(new Option(steArray[i][2],steArray[i][1]));
}
}
}
function view()
{
for(i=0;i<subtype.length;i++)
{
if(subtype(i).selected==true)
{
alert("文本是:"+subtype(i).innerText+";值是:"+subtype.value)
//也可以用document.getElementById("aa")[].innerText
break;
}
}
}
</script>
<body onLoad="cc('type')">
<select name="type" id="type" onChange="dd('subtype','type')">
<option value="0" selected="selected">请选择</option>
</select>
<select name="subtype" id="subtype">
<option value="0" selected="selected">请选择</option>
</select>
<input type="submit" name="Submit" onClick="view()" value="取出">
</body>
</html>
实例给你 .自己研究下.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询