在线给分,急急急!!如何从数据库中读取数据,然后显示在两极相关联选择框中的问题! 呵呵~~ 好像就是一个双关的 Select 框吧??只不过数组是由 ASP 或 PHP 等后台程序生成的罢了.. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一个例子<script language=javascript>function ch(selectedids,n) { var selectedvalue=selectedids var i var t=0 document.form1.s2.length=0 for(i=0;i<n;i++) { if(subcat[i][0]==selectedvalue) { document.form1.s2.options[t]=new Option(subcat[i][1],subcat[i][2]) t=t+1 } } } function check() { if (document.form1.s1.options.selectedIndex==0) { alert("请先选择类别") document.form1.s1.focus() return false } return true } /* function beginT(){ var t=window.showModalDialog("../calendar/calendar.htm",null,"dialogWidth:208px;dialogHeight:240px;status:no;help:no"); if (t!=null){ document.form1.T_in.value=t; } return;}*/</script></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width="780" border="0" cellspacing="0" cellpadding="0" height="38%" bordercolorlight="#000000" bordercolordark="#FFFFFF"><tr><td width="19%" valign="top" bgcolor="#FFCC00"> <!--#include file="menu3.asp" --></td><td width="81%" height="478" valign="top"><form name="form1" method="post" action="do_mod.asp" onsubmit="return datacheck()"><table width="100%" border="0"><tr bgcolor="#E6E0FE"><td width="12%" align="center">物品类别</td><td colspan="6"><script language="javascript">var subcat=new Array() <%dim n n=0 set rs=server.CreateObject("adodb.recordset") rs.ActiveConnection=conn rs.Source="select a.T_catid,a.T_name as xx ,a.T_id from cos_T_manage a join cos_T_catagery b on a.T_catid=b.T_id" rs.CursorType=1 rs.LockType=1 rs.Open do while not rs.EOF%> subcat[<%=n%>]=new Array("<%=rs("T_catid")%>","<%=rs("xx")%>","<%=rs("T_id")%>") <%n=n+1 rs.movenext loop%></script><select name="s1" onchange="ch(this.options.selectedIndex,<%=n%>)"><option value="0">--请选择--</option><%set rsd=server.CreateObject("adodb.recordset") rsd.ActiveConnection=conn rsd.Source="select T_id,T_name from cos_t_catagery" rsd.Open do while not rsd.EOF %><option value="<%=rsd("T_id")%>"><%=rsd("T_name")%></option><%rsd.MoveNext loop%> hehe~~ 我的意思就是楼上老大这样的做法... :)只是我懒得写代码.... asp or jsp?二者方法一样,如需例子,请告诉先 关于javascript中函数的形参是函数调用的情况的几点疑问? 请问用应该什么时候用GET方法,什么时候用POST方法 新手问题!求10个数子中的最小值 JS高手--赠100分--有关选项卡的页面传值 select下拉列表太长,怎么同时控制下拉列表的长度,并有联动功能 为什么我用这段JS来判断输入内容的有无和长短不起作用呢? js里如何实现动态生成网页! getElementsByName函数问题请求指点 如果一个单元格的id=p,那么怎样用js控制其中字符的颜色? 这两句的区别 help me net_love:救救我吧,看看我的问题
function ch(selectedids,n)
{
var selectedvalue=selectedids
var i
var t=0
document.form1.s2.length=0
for(i=0;i<n;i++)
{
if(subcat[i][0]==selectedvalue)
{
document.form1.s2.options[t]=new Option(subcat[i][1],subcat[i][2])
t=t+1
}
}
}
function check()
{
if (document.form1.s1.options.selectedIndex==0)
{
alert("请先选择类别")
document.form1.s1.focus()
return false
}
return true
}
/* function beginT(){
var t=window.showModalDialog("../calendar/calendar.htm",null,"dialogWidth:208px;dialogHeight:240px;status:no;help:no");
if (t!=null){
document.form1.T_in.value=t;
}
return;
}*/</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="780" border="0" cellspacing="0" cellpadding="0" height="38%" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr>
<td width="19%" valign="top" bgcolor="#FFCC00"> <!--#include file="menu3.asp" -->
</td>
<td width="81%" height="478" valign="top">
<form name="form1" method="post" action="do_mod.asp" onsubmit="return datacheck()">
<table width="100%" border="0">
<tr bgcolor="#E6E0FE">
<td width="12%" align="center">
物品类别
</td>
<td colspan="6">
<script language="javascript">
var subcat=new Array() <%dim n
n=0
set rs=server.CreateObject("adodb.recordset")
rs.ActiveConnection=conn
rs.Source="select a.T_catid,a.T_name as xx ,a.T_id from cos_T_manage a join cos_T_catagery b on a.T_catid=b.T_id"
rs.CursorType=1
rs.LockType=1
rs.Open
do while not rs.EOF%>
subcat[<%=n%>]=new Array("<%=rs("T_catid")%>","<%=rs("xx")%>","<%=rs("T_id")%>")
<%n=n+1
rs.movenext
loop%>
</script>
<select name="s1" onchange="ch(this.options.selectedIndex,<%=n%>)">
<option value="0">
--请选择--</option>
<%set rsd=server.CreateObject("adodb.recordset")
rsd.ActiveConnection=conn
rsd.Source="select T_id,T_name from cos_t_catagery"
rsd.Open
do while not rsd.EOF
%>
<option value="<%=rsd("T_id")%>">
<%=rsd("T_name")%>
</option>
<%rsd.MoveNext
loop%>
只是我懒得写代码....
二者方法一样,如需例子,请告诉先