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

一个js编写全选、弹出对话框、ajax-json的案例

   js功能有:全选、弹出对话框、使用json传输ajax数据;不想在写多余的文字了,直接上代码:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>词条微博</title>
<link rel="stylesheet" type="text/css" href="http://www.huimg.cn/app/baikesurvey/css/baikeSurveyCSS.css" />
<script type="text/javascript" src="http://www.huimg.cn/lib/jquery-1.7.min.js"></script>
<script src="http://www.huimg.cn/lib/jquery.dialog-0.8.min.js?10131624" type="text/javascript"></script>
<script src="/admin/js/weiboWidget.js" type="text/javascript"></script>
</head>
<body>
	<h3 style="text-align: center;">词条微博操作</h3>
	<div class="search-s">
		<form action="/weiboWidget.do?action=show" method="post">
			词条名:<input type="text" name="docTitle" id="docTitle" value="${docTitle }" />    微博UID:<input type="text" name="uid" id="uid" value="${uid }" />    <input type="submit" class="btn-b" value="查询" />    <input type="button" class="btn-b" value="重置"
				onclick="resetData()" />
		</form>
	</div>

	   
	<b>词条微博信息列表</b>   
	<input type="button" class="btn-b" value="删除" onclick="deleteData()" />   
	<input type="button" class="btn-b" value="添加" onclick="openAddWin()" />
	</br>
	</br>
	<div class="slist">
		<table>
			<tr>
				<th width="80" align="center"><input type="checkbox" id="checkAll" onclick="selectAll()" /> <b>全选</b></th>
				<th width="100" align="center">词条名</th>
				<th width="100" align="center">微博UID</th>
				<th width="140" align="center">操作</th>
			</tr>
			<c:if test="${count > 0 }">
				<c:forEach var="model" items="${weibos}">
					<tr>
						<td bgcolor="#ffffff" align="center"><input type="checkbox" name="id_list" value="${model.ID };${model.OBJECT_ID }" /></td>
						<td align="center"><a href="http://www.baike.com/wiki/${model.OBJECT_ID }" target="_blank">${model.OBJECT_ID }</a></td>
						<td align="center">${model.PARAM_VALUE}</td>
						<td align="center"><a href="#" onclick="javascript:openEditWin('${model.ID}');">编辑</a>
						</td>
					</tr>
				</c:forEach>
			</c:if>
			<c:if test="${count < 1 }">
				<tr>
					<td align="center" nowrap="nowrap" colspan="11"><font style='font-weight:bolder;' color='red'>暂无相关数据</font></td>
				</tr>
			</c:if>
		</table>
		&