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

JSP+Ajax添加、删除多选框实例

------引自:http://bbs.blueidea.com/thread-2673442-1-1.html

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
?contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>?
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"? prefix="fn" %>
<%
?String path = request.getContextPath();
?String basePath = request.getScheme() + "://"
???+ request.getServerName() + ":" + request.getServerPort()
???+ path + "/";
%>
<HTML>
<HEAD>
<TITLE> JSP+Ajax 添加删除Checkbox实例 example test</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script type="text/javascript">
function $() {
? var elements = new Array();
? for (var i = 0; i < arguments.length; i++) {
??? var element = arguments[i];
??? if (typeof element == 'string')
????? element = document.getElementById(element);
??? if (arguments.length == 1)
????? return element;
??? elements.push(element);
? }
? return elements;
}

//cody by jarry;
var emptyCol="",overCol="#f1f1f1",checkedCol="#F4FFF4";
function getAbsoluteLeft( ob ){
?if(!ob){return null;}
?? var obj = ob;
?? var objLeft = obj .offsetLeft;
?? while( obj != null && obj .offsetParent != null && obj .offsetParent.tagName != "BODY" ){
???? objLeft += obj .offsetParent.offsetLeft;
???? obj = obj .offsetParent;
?? }
?return objLeft ;
}

// get absolute TOP position
function getAbsolute