<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
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 'test.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 rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
<!--
function abc() {
return window.confirm("您真的要删除吗");
}
-->
</script>
</head>
<body>
<tr>
<td><a onclick="return abc();" href=login.jsp>删除用户</a></td>
</tr>
</body>
</html>
以上是源码,当我点删除用户的时候,没弹出提示框直接跳到login.jsp了,到底是什么原因啊,想了好久。
<%
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 'test.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 rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
<!--
function abc() {
return window.confirm("您真的要删除吗");
}
-->
</script>
</head>
<body>
<tr>
<td><a onclick="return abc();" href=login.jsp>删除用户</a></td>
</tr>
</body>
</html>
以上是源码,当我点删除用户的时候,没弹出提示框直接跳到login.jsp了,到底是什么原因啊,想了好久。
function abc() {
if(window.confirm("您真的要删除吗")){
window.location.href="login.jsp";
}else{
return;
}
}
</script>
<body>
<a onclick="abc()" >删除用户</a></td>ps:比对下看看。
<a href="javascript:void(0)" onclick="toChart(this.id);" id="${report.siteId}">
${report.name}
</a>