标签:
jsp代码:
<%@ page language ="java" pageEncoding="UTF-8"%>
<%@ taglib uri ="http://java.sun.com/jsp/jstl/core" prefix= "c"%>
<%@taglib prefix= "s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> 仓库管理</title >
<link rel= "stylesheet" type ="text/css"
href="< c:url value= ‘/css/maple.css‘/>" ></link >
<style type= "text/css">
.tx td {
padding: 3px;
}
.store {
width: 100%;
border: 1px solid gray;
border-collapse: collapse;
}
.store td {
border: 1px solid gray;
padding: 3px;
}
.store a {
text-decoration: underline;
color: blue;
}
</style>
<script type= "text/javascript"
src="${pageContext.request.contextPath} /js/jquery-1.7.2.js"></script >
<script type= "text/javascript">
// 页面加载执行下面函数
$( function() {
// 给超链接添加点击事件
$( "a[name=‘deleteStore‘]" ).click(function(event) {
// 弹出框提示信息
var flag = window.confirm("确认删除吗?");
if (!flag) {
// 取消默认行为执行
event.preventDefault();
}
});
});
</script>
</head>
<body>
<a href= "${pageContext.request.contextPath} /store_delete?id=<s:property value ="#store.id"/>"
name= "deleteStore">删除</a >
项目截图:
js文件的位置:
注意script标签的位置:
a标签:
阻止默认行为执行
标签:
原文地址:http://www.cnblogs.com/lydong/p/5104203.html