<%
dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from sorts order by sortsorder ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("sorts"))%>","<%= rs("categoryid")%>","<%= rs("sortsid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.sortsid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.sortsid.options[document.myform.sortsid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
function checkpro()
{
if(checkspace(document.myform.name.value)) {
document.loginfo.username.focus();
alert("请添用户名!");
return false;
}
if(checkspace(document.myform.type.value)) {
document.loginfo.type.focus();
alert("请添密码!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
function regInput(obj, reg, inputStr)
{
var docSel = document.selection.createRange()
if (docSel.parentElement().tagName != "INPUT") return false
oSel = docSel.duplicate()
oSel.text = ""
var srcRange = obj.createTextRange()
oSel.setEndPoint("StartToStart", srcRange)
var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
return reg.test(str)
}
//-->
</script>
<select name="categoryid" size="1" id="categoryid" onChange="changelocation(document.myform.categoryid.options[document.myform.categoryid.selectedIndex].value)">
<option selected value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
<%
dim selclass
selclass=rs("categoryid")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
所属小类
<select name="sortsid">
<% rs.open "select * from sorts where categoryid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("sortsid")%>"><%=rs("sorts")%></option>
<% rs.movenext
do while not rs.eof %>
<option value="<%=rs("sortsid")%>"><%=rs("sorts")%></option>
<% rs.movenext
loop
end if
rs.close
rs.open "select * from TimesProList",conn,1,1
%>
</select>
</td>
</tr>
<tr>
<td><input name="prename" type="text" id="prename" value="<% =rs(0) %>" size="10">
</td>
<td> <input name="name" type="text" id="name" size="25">
</td>
</tr>
<tr>
<td><input name="other" type="text" id="other" value="<% =rs(3) %>" size="10"></td>
<td> <INPUT name="jj" type="text" size="25">
</td>
</tr>
<tr>
<td><input name="intro" type="text" id="intro" value="<% =rs(2) %>" size="10"></td>
<td> <INPUT name="introduce" type="text" size="25">
</td>
</tr>
<tr>
<td height="9"> <input name="graph" type="text" id="graph" value="<% =rs(8) %>" size="10"></td>
<td> <input name="pic" type="text" id="pic" size="30" VALUE="images/emptybook.jpg">
<input type="button" name="Submit11" value="上传" onClick="window.open('../upfile.asp?formname=myform&editname=pic&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
</td>
</tr>
<tr>
<td height="9"> <input name="graph" type="text" id="graph" value="上传缩微图" size="10"></td>
<td> <input name="pic1" type="text" id="pic1" size="30" VALUE="images/emptybook.jpg">
<input type="button" name="Submit11" value="上传" onClick="window.open('../upfile.asp?formname=myform&editname=pic1&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
</td>
</tr>
<tr>
<td valign="top"><input name="description" type="text" id="description" value="<% =rs(11) %>" size="10">
</td>
<td><textarea name="detail" cols="25" rows="5"></textarea>
</td>
</tr>
<tr>
<td height="25"></td>
<td>
<select name="recommend" id="recommend">
<option value="0">一般产品</option>
<option value="1">精品推荐</option>
</select> <input type="submit" name="Submit" value="提交" onClick="return checkpro();">
</td>
<% rs.close
set rs = nothing
conn.Close
set conn = nothing %>
</tr>
</table>
</form>这个是联动菜单代码
先解决问题不要灌水..