日期:2014-05-17  浏览次数:21030 次

我想用下拉框挑选出zhuanti字段等于下拉框的文章
我想用下拉框挑选出zhuanti字段等于下拉框的文章,下拉框的内容在表zhuanti总读取。我想用下面的代码实现,可是总是无法挑选呢。

C# code
跳转到:&nbsp;<script type="text/JavaScript"> 
<!-- 
function MM_jumpMenu(targ,selObj,restore){ //v3.0 
eval(targ+".location='?zhuanti="+selObj.options[selObj.selectedIndex].value+"'"); 
if (restore) selObj.selectedIndex=0; 
} 
//--> 
</script> 
<select name="id" id="id" onchange="MM_jumpMenu('self',this,0)"> 
<% set rs1=server.CreateObject("adodb.recordset") 
sql1 ="select * from zhuanti" 
rs1.open sql1,conn,1,1 
Response.Write("<option value="""">请选择专题</option>") 
if rs1.eof and rs1.bof Then 
response.write("<option value="""">请先添加专题</option>") 
else 
while not rs1.eof 
response.write("<option value="""& rs1("id") &""">" & rs1("name") & "</option>")
 If int(request("zhuanti"))=Rs1("ID") then
                Response.Write(" selected" ) 
         End if

rs1.movenext 
wend 
end if 
%> 
</select>



操作下拉框,怎么挑选不出任何数据呢?

------解决方案--------------------
这个selected应该写在option里面吧?

------解决方案--------------------
<select name="id" id="id" onchange="MM_jumpMenu('self',this,0)"> 
<% set rs1=server.CreateObject("adodb.recordset") 
sql1 ="select * from zhuanti" 
rs1.open sql1,conn,1,1 
if rs1.eof Then 
response.write("<option value="""">请先添加专题</option>") 
else 
Response.Write("<option value="""">请选择专题</option>") 
do while not rs1.eof 
response.write("<option value="""& rs1("id") &""">" & rs1("name") & ")
If int(request("zhuanti"))=Rs1("ID") then Response.Write(" selected" ) 
response.write("</option>")
rs1.movenext 
loop 
end if
rs1.close
set rs1=nothing 
%> 
</select>




------解决方案--------------------
你把 on error resume next 屏蔽掉 看下怎么报错的吧~~