提交时页面跳转问题

accpcj 2005-09-21 06:50:35
这个是静态页面代码!

<script language="JavaScript" type="text/JavaScript">

confirm("有相同的用户还需要增加么?");
document.myform.action = "InsertPresMedicine";
document.myform.submit();

</script>


<script language="JavaScript" type="text/JavaScript">

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
window.opener=null;

window.top.close();
}

</script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;>
<link rel="stylesheet" type="text/css" href="masterment.css">
<title>load</title>
</head>

<body leftmargin="0" rightmargin="0" topmargin="0" onload="document.myform.yakuzicode.focus();" >

<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFCCFF"><strong>load</strong></td>
</tr>
</table>
<p>  </p>
<form name="myform" method="post" action="UpYakuzi">

<table width="70%" height="59" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr height="30">
<td width="35%" bgcolor="#D9D9FF"><div align="center"> code </div></td>
<td width="65%" bgcolor="#D9D9FF"><div align="center">
<input name="yakuzicode" type="text" size="20" maxlength="15">
</div></td>
</tr>
<tr height="30">
<td bgcolor="#D9D9FF"><div align="center"> name </div></td>
<td bgcolor="#D9D9FF"><div align="center">
<input name="yakuziname" type="text" size="20" >
</div></td>
</tr>
<tr height="30">
<td bgcolor="#D9D9FF"><div align="center"> yjcode</div></td>
<td bgcolor="#D9D9FF"><div align="center">
<input name="yjcode" type="yjcode" size="20" maxlength="20">
</div></td>
</tr>
</table>
<p> </p>
<table width="71%" border="0" align="center" cellpadding="1" cellspacing="1">

<tr>
<td width="50%" align = "right">
<input type="button" class="buttonload1" onClick="MM_openBrWindow('masterment.jsp','','status=yes,width=400,height=450,left=312,top=130')" value ="cancle">

</td>



<td width="50%"><div align="right">
<input type="submit" name="submit" value="load" class="buttonload1"
onClick = "return formsubmit()" size="5">
</div></td>
</tr>
</table>

<script language="JavaScript">
function formsubmit(){

return confirm("要注册么?");
}
</script>
</form>
<p> </p>
</body>

我现在的问题是:
confirm("有相同的用户还需要增加么?");
document.myform.action = "InsertPresMedicine";
document.myform.submit();
提交不了 !请问如何解决呀?
程序是这样的。首先点击 load 报出对话框 “要注册么?”点 确定,后台查找到有这个用户就问“有相同的用户还需要增加么?”,在点“确定”就增加,点“返回”不增加?现在我的程序走到“有相同的用户还需要增加么?”的时候,点确定出现了错误,说 document.myform.action =null;请问如何解决??

...全文
202 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
accpcj 2005-09-22
  • 打赏
  • 举报
回复
lee_wei(争取做一个好农民!) 兄台说的对,可是我已经有一个action="UpYakuzi"要处理,当处理过后经过判断才去处理document.myform.action = "InsertPresMedicine";的。如果说页面只要一个submit的话应该使用兄台的这样方式很对!在一次感谢!!!
accpcj 2005-09-22
  • 打赏
  • 举报
回复
qiangsheng(做人很厚道) 兄台高见,<form name="myform" method="post" action="UpYakuzi">里面就可以执行到了!!现在已经可以了!谢谢 HHH3000(蓝色爱琴海 阿信fans 001号)、qiangsheng(做人很厚道) 、lee_wei(争取做一个好农民!) ,大家接分吧!!
lee_wei 2005-09-22
  • 打赏
  • 举报
回复
给楼主个建议:
我个人觉得在提交表单进行js验证时,我都习惯用
<form on_submint="return chkForm(this);">这样的形式
更加清晰明了不是吗
lee_wei 2005-09-22
  • 打赏
  • 举报
回复
应该是document.all.myform.action
或者
document.getelementbyid(myform).action
qiangsheng 2005-09-22
  • 打赏
  • 举报
回复
你应该把javascript写到head块里面,不能放在html块外头。
accpcj 2005-09-22
  • 打赏
  • 举报
回复
return confirm("要注册么?");
这样可以的,我已经试过了。
在这里 <input type="submit" name="submit" value="load" class="buttonload1"
onClick = "return formsubmit()" size="5">
可以通过的。
现在是
<script language="JavaScript" type="text/JavaScript">
// confirm("有相同的用户还需要增加么?");
confirm("<%=strErr%>");
document.myform.action = "InsertPresMedicine";
document.myform.submit();

</script>
这里过不了,javascript说document.myform为null,不知道为什么?
HHH3000 2005-09-22
  • 打赏
  • 举报
回复
return confirm("要注册么?");
这么写不对,要这样

if (confirm("要注册么?")){
return true;
}else{
trturn false;
}
accpcj 2005-09-22
  • 打赏
  • 举报
回复
有人知道怎么解决这个问题么?
accpcj 2005-09-21
  • 打赏
  • 举报
回复
这个是jsp的源代码!

<%@ page contentType="text/html; %>
<%@ page import="jp.co.infocom.alert.master.common.FormView"%>
<%@ page import="java.util.*"%>
<%
String strUid = (String)session.getAttribute("UserID");

String isFail = request.getParameter("fail");

if (isFail == null) {
isFail = "";
}
String strErr = FormView.getErrMsg();
if(isFail.trim().equals( "error")){
%>
<script language="JavaScript" type="text/JavaScript">
// confirm("有相同的用户还需要增加么?");
confirm("<%=strErr%>");
document.myform.action = "InsertPresMedicine";
document.myform.submit();

</script>
<%}%>

<script language="JavaScript" type="text/JavaScript">

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
window.opener=null;

window.top.close();
}

</script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html>
<link rel="stylesheet" type="text/css" href="masterment.css">
<title>load</title>
</head>

<body leftmargin="0" rightmargin="0" topmargin="0" onload="document.myform.yakuzicode.focus();" >

<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFCCFF">   <strong>load</strong> </td>
</tr>
</table>
<p>  </p>
<form name="myform" method="post" action="UpYakuzi">

<table width="70%" height="59" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr height="30">
<td width="35%" bgcolor="#D9D9FF"><div align="center"> code </div></td>
<td width="65%" bgcolor="#D9D9FF"><div align="center">
<input name="yakuzicode" type="text" size="20" maxlength="15">
</div></td>
</tr>
<tr height="30">
<td bgcolor="#D9D9FF"><div align="center"> name </div></td>
<td bgcolor="#D9D9FF"><div align="center">
<input name="yakuziname" type="text" size="20" >
</div></td>
</tr>
<tr height="30">
<td bgcolor="#D9D9FF"><div align="center"> yjcode </div></td>
<td bgcolor="#D9D9FF"><div align="center">
<input name="yjcode" type="yjcode" size="20" maxlength="20">
</div></td>
</tr>
</table>
<p> </p>
<table width="71%" border="0" align="center" cellpadding="1" cellspacing="1">

<tr>
<td width="50%" align = "right">
<input type="button" class="buttonload1" onClick="MM_openBrWindow('masterment.jsp','','status=yes,width=400,height=450,left=312,top=130')" value ="cancle">

</td>


<td width="50%"><div align="right">
<input type="submit" name="submit" value="load" class="buttonload1"
onClick = "return formsubmit()" size="5">
</div></td>
</tr>
</table>

<script language="JavaScript">
function formsubmit(){

return confirm("要注册么?");
}
</script>
</form>
<p> </p>
</body>


61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧