为什么location.href="edit.asp"没用

litsnake1 2003-10-16 10:43:45
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>刊物</title>
<script language="VBScript">
<!--
sub button_click()
if document.forms(0).magazine.value = "" then
msgbox "刊物的名称不能为空"
document.forms(0).magazine.select
else
location.href = "edit.asp"
end if
end sub
-->
</script>

</head>

<body>
<table width="75%" border="1" align="center">
<tr>
<td>
<form name="form1" method="post" onSubmit="button_click">
<div align="center">搜索刊物
<input type="text" name="magazine">
<input type="submit" name="search" value="搜索">
</div>
</form></td>
</tr>
<tr>
<td><form name="form2" method="post" action="edit.asp">
<div align="center"><input type="submit" name="edit" value="维护"></div>
</form></td>
</tr>
<tr>
<td><form name="form2" method="post" action="add.asp">
<div align="center"><input type="submit" name="add" value="增加"></div>
</form></td>
</tr>
</table>
</body>
</html>

*******************************************************

但我点击搜索的时候,他并没edit.asp页面去,还是停留原来的页面,不知道为什么,请问这是什么问题,应该怎么解决,

谢谢!!
...全文
105 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ryuginka 2003-10-16
  • 打赏
  • 举报
回复
<form name="form1" method="post" action ="edit.asp" onSubmit="button_click">

litsnake1 2003-10-16
  • 打赏
  • 举报
回复
我试过了,form1.action = "edit.asp"是可以的,

谢谢!

现在还一个问题要请教各位:

就是我在输入框中输入刊物的名称,在点击搜索的时候先要判断输入框是否为空,不为空的话就,要将输入框中的内容放到session中,然后在跳转到edit.asp 页面,当然我可以在edit.asp中处理但由于其他原因觉得这样不好,所以我想在能不能实现我刚才所描述的东西,

谢谢!·
xxrl 2003-10-16
  • 打赏
  • 举报
回复
也可以写成self.location.href="edit.asp",vbscript支持self吗?
xxrl 2003-10-16
  • 打赏
  • 举报
回复
应该是form2.actin="edit.asp"
homeyang 2003-10-16
  • 打赏
  • 举报
回复
window.location="edit.asp"

用这个看看

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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