我晕想搞了半天,没有找到原因,为什么 sumbDepartFrm 脚本没有作用 ?

Justin1818 2004-04-10 03:13:35
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- '#INCLUDE file="PgInationDepartment.asp" -->
<!-- '#INCLUDE file="../conn/connmdb.asp" -->
<!-- '#INCLUDE file="../pub/LoadSel.asp" -->


<%
dim countryid,cityid,branchid
countryid=request.form("countrySel")
cityid=request.form("citySel")
branchid=request.form("BranchSel")

'if Session("Admin_OTI")="2" then
' else
' response.Redirect("log.asp")
' end if

dim errcode
dim idStr
dim CidStr
dim Departmentid
dim actionstr

errcode=trim(request.QueryString("errcode"))
idStr=trim(request.QueryString("idStr"))
CidStr=trim(request.QueryString("CidStr"))
actionstr="Add"

if CidStr<>"" then actionstr="Update" : Departmentid=CidStr
if idStr<>"" then
Departmentid=idStr
Del_Department
end if
%>

<html>
<head>
<style type="text/css">
input {
border: 1px solid gray;
height: 23px;
color : blue;
width : 70px;
font-family: arial,宋体;
font-size: 11px;
font-weight: bold;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Type for Administrator</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body bgcolor="#CCCCCC" >
<p align="center"><font color="#993333" size="6" face="Geneva, Arial, Helvetica, sans-serif"><strong><font color="#FFFFFF" size="+3" face="Verdana, Arial, Helvetica, sans-serif">GLOBAL
VSL CREATION CENTER</font></strong> <br>
<font size="-2"><strong><em>------------- <font size="-1">Add Department</font></em><br>
<% select case errcode
case "1" :
response.Write("Sorry, Current Department CODE have exist !")
case "2" :
response.Write("Sorry, pls input a Department CODE to post !")
case "3" :
response.Write("You have Submit have Succeed !")
end select
%>
</strong></font></font></p>
<form name="DepartFrm" method="post" >
<table width="35%" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr>
<td width="48%" height="38"><font color="#FFFFFF" size="-1" face="Geneva, Arial, Helvetica, sans-serif"><strong>COUNTRY</strong></font></td>
<td width="52%"><select name="CountrySel" size="1" onChange="return sumb_Action();">
<option value=0 >....</option>
<% Load_Country%>
<%
if countryid<>0 then
sql="select * from [COUNTRY_TAB] WHERE COUNTRY_ID="&request.Form("CountrySel")
Conn_VSLMDB
set rs=conn.execute(sql)
response.write "<option value='"&request.Form("CountrySel")&"' selected>"&rs("COUNTRY_CODE")&"</option>"
set rs=nothing
conn.close
end if
%>
</select></td>
</tr>
<tr>
<td height="25"><font color="#FFFFFF" size="-1" face="Verdana, Arial, Helvetica, sans-serif"><strong>CITY CODE</strong></font></td>
<td><select name="CitySel" size="1" onChange="return sumb_Action();">
<option value=0 >....</option>
<%
if countryid<>0 then
Load_City countryid
if Cityid<>0 then
sql="select * from [CITY_TAB] WHERE CITY_ID="&cityid&" AND COUNTRY_ID="&Countryid
Conn_VSLMDB
set rs=conn.execute(sql)
response.write "<option value='"&cityid&"' selected>"&rs("CITY_CODE")&"</option>"
set rs=nothing
conn.close
end if
end if
%>
</select></td>
</tr>
<tr>
<td height="32"><font color="#FFFFFF" size="-1" face="Geneva, Arial, Helvetica, sans-serif"><strong>BRANC CODE </strong></font></td>
<td><select name="BranchSel" size="1" onChange="return sumb_Action();">
<option value=0 >....</option>
<%
if Cityid<>0 then
Load_Branch cityid
if Branchid<>0 then
sql="select * from [Branch_TAB] WHERE Branch_ID="&Branchid&" AND CITY_ID="&cityid
Conn_VSLMDB
set rs=conn.execute(sql)
response.write "<option value='"&Branchid&"' selected>"&rs("Branch_CODE")&"</option>"
set rs=nothing
conn.close
end if
end if
%>
</select></td>
</tr>
<tr>
<td><font color="#FFFFFF" size="-1" face="Geneva, Arial, Helvetica, sans-serif"><strong>DEPARTMENT</strong></font></td>
<td><input name="DepartmentNAME_Txt" type="text" style="font-family: Verdana; font-size: -1pt; width: 150; height: 20" ></td>
</tr>
<tr>
<td height="35"> </td>
<td><input name="Submit" type="button" value="<%=actionstr%>" onClick="sumbDepartFrm();">
<input name="Submit2" type="button" value="Back" onClick=" window.history.back();"></td>
</tr>
</table>
<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; visibility: hidden;">
<input name="DepartIDTXT" type="text" size="5" value="<%=Departmentid%>">
<br>
<br>
</div>
</form>
<%
if branchid<>0 then
dim sql
sqlstr="select * FROM [DEPART_TAB] WHERE BRANCH_ID="&branchid&" AND COUNTRY_ID="&countryid&" AND CITY_ID="&cityid
URLs="Admin_depat.asp"
Conn_VSLMDB
pageNums=request("page")
cutPage sqlStr,Conn,10,pageNums,URLs
end if
%>

</body>
</html>
<script>
<!--

function sumb_Action(){
this.document.DepartFrm.Action="Admin_depart.asp";
this.document.DepartFrm.submit();
}

function sumbDepartFrm(){
this.document.DepartFrm.Action="OpDepart.asp";
this.document.DepartFrm.submit();
}
//-->
</script>
...全文
13 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Justin1818 2004-04-12
sorry, Action 在JAVASCRIPT 中应为 ‘action' 小写就可以了
回复
Justin1818 2004-04-12
不好意思搞掂,原来是Action 应为大写,


还有一个问题, 哪就是:
<form name="DepartFrm" method="post" action="" >
....
</form>

A>
<input name="Submit" type="Submit" value="<% response.write actionstr%>">

B>
<input name="Submit" type="button" onClick="return Jump_Action(this);" value="<% response.write actionstr%>">


function Jump_Action(Obj){
var str
var fd
str=""
fd=false;
switch (Obj.name){
case "CountrySel" :
str="Admin_depart.asp";
fd=true;
break;
case "CitySel" :
str="Admin_depart.asp";
fd=true
break;
case "BranchSel" :
str="Admin_depart.asp";
fd=true;
break;
}
switch (Obj.value) {
case "Add" :
str="Opdepart.asp";
fd=CheckDepartFrm();
break;
case "Update" :
str="Opdepart.asp";
fd=CheckDepartFrm();
break;
case "Del" :
str="Opdepart.asp";
fd=CheckDepartFrm();
break;
}
document.DepartFrm.action=str;
if(fd==true){
document.DepartFrm.submit();
}

}
//-->
</script>

B> 方法采用
document.DepartFrm.submit(); 在
Opdepart.asp

当Submit有值时,
response.write request.form("Submit") 为空 ?????



回复
diveas 2004-04-10
帮你顶上去
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告