标题:[原创]联动菜单提交完返回时出现的问题
取消只看楼主
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
结帖率:77.27%
 问题点数:0 回复次数:14 
[原创]联动菜单提交完返回时出现的问题
我做的那个二级联动的菜单在提交完了以后用这个代码response.Write "<script language=javascript>alert('提交成功!');history.go(-1);</script>"返回后..大类没变可小类变了.........变成第一个大类的第一个小类了........我想应该是返回时那个联动菜单没取得值..不知道这个怎么做.....
搜索更多相关主题的帖子: 菜单 script response history 
2006-03-30 10:58
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 

<%
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>这个是联动菜单代码


面朝大海,春暖花开!
2006-03-30 11:00
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 
dim action,id,temp,strContent,i,strDetail
id=Request("id")
action=Request("action")
select case action
case "add"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from product",conn,1,3
rs.AddNew
rs("prename")=trim(request.form("prename"))
rs("pic1")=trim(request.form("pic1"))
rs("name")=trim(request.form("name"))
rs("company")=trim(request.form("company"))
rs("mark")=trim(request.form("mark"))
rs("intro")=trim(request.form("intro"))
rs("introduce")=trim(request.form("introduce"))
rs("predate")=trim(request.form("predate"))
rs("price")=trim(request.form("price"))
rs("other")=trim(request.form("other"))
rs("jj")=request.form("jj")
rs("pic")=trim(request.form("pic"))
rs("graph")=trim(request.form("graph"))
rs("graph2")=trim(request.form("graph2"))
rs("photo")=trim(request.form("photo"))
rs("addlink")=trim(request.form("addlink"))
rs("link")=trim(request.form("link"))
rs("description")=trim(request.form("description"))
rs("categoryid")=int(request.form("categoryid"))
rs("sortsid")=int(request.form("sortsid"))
rs("mark")=trim(request.form("mark"))
rs("remarks")=trim(request.form("remarks"))
rs("productdate")=productdate
rs("discount")=discount
rs("score")=request.form("score")
rs("amount")=request.form("amount")
rs("stock")=request.form("stock")
rs("grade")=trim(request.form("grade"))
rs("prestock")=trim(request.form("prestock"))
rs("pretype")=trim(request.form("pretype"))
rs("type")=trim(request.form("type"))
rs("recommend")=trim(request.form("recommend"))
rs("adddate")=Now()
rs("solded")=0
rs("viewnum")=0
rs("rank")=0
rs("ranknum")=0
strDetail=Request.Form("detail")
rs("detail")=strDetail
For i = 1 To Request.Form("content").Count
strContent = strContent & Request.Form("content")(i)
Next
rs("content")=strContent
rs.Update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write "<script language='javascript'>alert('添加信息成功!');window.location.href='addpro.asp'; </script>"
response.End
这个是后台取值的代码..

面朝大海,春暖花开!
2006-03-30 11:00
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 
那个客户就是想录入时简单点......提交完一条后返回时还保留原来的类别改一下产品名称还可以提交到这个类别里面..因为他产品特多..录入时每次都选类别比较麻烦..
就是他们说的那个联动菜单的记忆功能..

面朝大海,春暖花开!
2006-03-30 11:03
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 
以下是引用google在2006-3-30 11:01:00的发言:
我前两天也做了一个
不过很菜的
呵呵

没用主流的设计方式
不过不会出现你那样的问题

先解决问题不要灌水..


面朝大海,春暖花开!
2006-03-30 11:03
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 
救命呀.

面朝大海,春暖花开!
2006-03-30 11:05
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 
把代码弄出来...我看看..你不要告诉我你是用.NET做的..

面朝大海,春暖花开!
2006-03-30 11:11
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 

楼上的闭嘴..


面朝大海,春暖花开!
2006-03-30 11:19
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 

这样的不行..


面朝大海,春暖花开!
2006-03-30 13:44
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
得分:0 
response.Write "&lt;script language='javascript'&gt;alert('添加信息成功!');window.location.href='addpro.asp'; &lt;/script&gt;"用这个怎么传值呀...必须用这个才可能传值呀

面朝大海,春暖花开!
2006-03-30 13:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-53861-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.261420 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved