jsp中的button onclick事件失效

-飞奔的小蜗牛- 2011-04-17 09:49:44
发布在tomcat下,一直运行没问题,今天去吃晚饭回来,继续做了几个页面,跑来看时突然发现以前有个页面的button按了什么反应没有。
查资料书,又baidu还是搞不清楚到底因为啥?

重新发布还是不行...

路过的大大们。。求拯救。。明天上午要交这个项目作业。 欲哭啊...


button失效的jsp页面代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'vetSearch.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="layout.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" language="javascript">
<!--
function check2(){
if(document.petS.pet_name.value==""&&document.petS.pet_owner.value==""){
alert("请输入一个查询项!");
document.petS.pet_name.focus();
document.petS.pet_owner.focus();
return false;
}else{
document.petS.action="petSearch";
return true;
}
function exit(){
window.location.href("employeeLogin.jsp");
}
function addPet(){
window.location.href("addPet.jsp");
}
function addOwner(){
window.location.href("addOwner.jsp");
}
-->
</script>

</head>

<body>
<div id="container">
<div id="header"><hr><h1><center>宠物查询</center></h1></div>
<div id="menu">
<br/>
<p class="one">【宠物】</p>  
<p class="two"><a href="vetSearch.jsp">【兽医】</a></p>
<p class="three"><a onclick="exit()">【退出】</a></p>
</div>
<div id="mainContent">
<form method="post" name="petS" onsubmit="return check2()">
<table align="center" cellspacing="10">
<tr><td>宠 物 名 称:</td>
<td>     <input type="text" name="pet_name"></td></tr>
<tr><td>所有人名称:</td>
<td>     <input type="text" name="pet_owner"></td></tr>
<tr><td colspan="2" align="center">

<input type="submit" value="查询">
<input type="button" value="增加新宠物" disables="false" onclick="addPet()">
<input type="button" value="增加新所有人" disables="false" onclick="addOwner()"></td></tr>
</table>
</form>
</div>
<div id="footer">
<center><h1><%=request.getAttribute("")%></h1></center>
</div>
</div>
</body>
</html>


别的页面都没问题。仅仅是跳转的button都失效了...应该跟配置文件还有servlet没关系的。
...全文
765 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cicada888 2011-04-18
  • 打赏
  • 举报
回复
= = 只为结贴来。
  • 打赏
  • 举报
回复

自己解决了。
我勒个去、
用shift+ctrl+f时不小心A掉一个 }...

搞笑了..
  • 打赏
  • 举报
回复


不要沉啊...在线等待。

为什么添加多个button这容易失效啊。

别的页面的button全没事。

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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