日期:2014-05-16  浏览次数:20425 次

JSP 用JS做到任意显示删除,随心所欲。
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../include/mytaglib.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>增加商品组</title>
<link rel="shortcut icon" href="<%=request.getContextPath()%>/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/blueprint/admin.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/pis/pis.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/pis/new_screen.css" media="screen, projection">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/pis/new_typography.css" media="screen, projection">

	<link rel="stylesheet" href="<%=request.getContextPath()%>/jqueryUI/themes/base/jquery.ui.all.css">
	
 	<style type="text/css">
	tr {height: 20px;}
	th {	background: #0066FF;color: #FFFFFF;line-height: 20px;height: 20px;}
	td {	white-space: nowrap;border-bottom: 1px solid #95bce2;vertical-align: top;height: 20px;	}
	tr.alt td{ background: #ecf6fc;	}
	tr.over td{ background: #bcd4ec; }
	</style>		
<script type="text/javascript" src="<%=request.getContextPath()%>/js/datatable/jquery.js"></script>

<script src="<%=request.getContextPath()%>/jqueryUI/external/jquery.bgiframe-2.1.2.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.core.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.widget.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.mouse.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.button.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.draggable.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.position.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.resizable.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.ui.dialog.js"></script>
<script src="<%=request.getContextPath()%>/jqueryUI/ui/jquery.effects.core.js"></script>
<script src="<%=request.getContextPath()%>/js/page/regex.js"></script>

<script type="text/javascript" src="<%=request.getContextPath()%>/js/jsdate/jsdate.js"></script>
<script language="javascript">

$(function() {
	$( "#save-btn" ).button().click(function() {
		if( validate(0)){
		//ajax提交
		var params = initFCParams();
		params = params + initLocalParams();
		//alert(params);
		var openURL = "<%=request.getContextPath()%>/product/productGroupManagement_saveTProductGroup.do" ;
		$.ajaxSetup({cache:false});
		$.ajax( {
			"type": "POST", 
			"url": openURL, 
			"dataType": "text",
			"data":  (params) , 
			"success": function(oRequest) {
				callbackF(oRequest);
			}
		});	
		}else{
			return false;
		}
	});	
	$( "#cancel-btn" ).button().click(function() {
		window.location.href = "<%=request.getContextPath()%>/webpage/productgroupmanagement/pro_group_mange.jsp";
	});

});	

function initLocalParams(){
	var localParams = "";
	localParams = localParams 
					+ "&tpgDTO.id=" + $("#tpgDTOId").val()
					+ "&tpgDTO.groupName=" + $("#groupName").val() 
					+ "&tpgDTO.remark=" + $("#remark").val() ;
	return localParams;
}

function callbackF(oRequest){
	alert("保存成功!");
	$( "#cancel-btn" ).button().click();
}
</script>
</head>
<body>
<div id=mytips style="position:absolute;background-color:#fff