时光验证经典

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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>
 
 
<href= "${pageContext.request.contextPath} /store_delete?id=<s:property value ="#store.id"/>"
 name= "deleteStore">删除</a >
 

 
项目截图:

js文件的位置:
阻止默认行为执行 - imalaska - imalaska的博客
 
 

注意script标签的位置:
阻止默认行为执行 - imalaska - imalaska的博客
 
 

a标签:
阻止默认行为执行 - imalaska - imalaska的博客
 
 
posted on 2016-01-06 00:20  时光验证经典  阅读(195)  评论(0)    收藏  举报