ASP 下拉菜单为什么取不到值

来源:百度知道 编辑:UC知道 时间:2024/05/15 03:15:16
<SCRIPT language=JavaScript type=text/JavaScript>
<!--

function ggothere(){
var thebox=document.footerForm

newwindow=window.open("")
newwindow.location=
thebox.site.options[thebox.site.selectedIndex].value

}

//-->
</SCRIPT>
<FORM name=footerForm>
<SELECT onchange=javascript:ggothere(); name=site size="1">
<OPTION value=0 selected>系统友情链接</OPTION>
<%
set rs2=server.createobject("adodb.recordset")
sql2="select * from link order by id DESC"
rs2.open sql2,conn,3,3
%>
<% do while not rs2.eof%>
<OPTION value=<%=rs2("url")%>><%=rs2("name")%></OPTION>
<% rs2.movenext
loop
rs2.close%>
</SELECT>

thebox.site.options[thebox.site.selectedIndex].value
这一句
thebox应该是from的name
site应该是SELECT 的name

这两个一定要对!

这个很简单!

如果你的<option>的value值也就是你数据库中表"link"中的"url"中的值是外部链接则必须是绝对路径!

例如:
错误的:
<option value="www.baidu.com">
正确的:
<option value="http://www.baidu.com">