日期:2014-05-16 浏览次数:20354 次
?? 本人也是jquery的新手,写得若有问题,请大家提出宝贵意见共同提高.
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/common/taglib.jsp"%> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style/manageStyle.css" rel="stylesheet" type="text/css" /> <link type="text/css" rel="stylesheet" href="style/ui-base/jquery-ui.css" /> <style type="text/css"> body { text-align: left; } .content { width: 50%; text-align: center; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; } td { padding: 7px; } form input { font-size: 20px; } </style> <script src="js/jquery.js"></script> <script src="js/jquery-ui.js"></script> <script src="js/jquery.json-2.3.js"></script> <script src="/${projectName}/studentExam/js/jquery.validate.min.js"></script> <script language="javascript"> function removeProblem(problemId,type){ if(type==1) $("'.simple"+problemId+"'").remove(); else if(type==2) $("'.multi"+problemId+"'").remove(); else if(type==3) $("'.notConfirm"+problemId+"'").remove(); else if(type==4) $("'.choose"+problemId+"'").remove(); else if(type==5) $("'.simpleSubject"+problemId+"'").remove(); else if(type==6) $("'.communication"+problemId+"'").remove(); } function toPage(current,tp){ $.post("/${projectName}/getPagedProblems.ajax", { type:tp, currentPage:current }, function(data){ var daohang = ''; var mydata = eval('('+data+')'); var info = '<tr><th>选择</th><th>题目名称</th><th>教材</th><th>章</th><th>节</th><th>详情</th></tr>'; $.each(mydata.list,function(index,entity) { info += "<tr><td><input type=checkbox name='SelectedProblems"+tp+"' value='"+entity.problemId+"'/></td><td>"+entity.problemName+"</td><td>"+(entity.knowledgepoint==null?'nothing':entity.knowledgepoint.book.bookName)+"</td><td>"+(entity.knowledgepoint==null?'nothing':entity.knowledgepoint.chapter)+"</td><td>"+(entity.knowledgepoint==null?'nothing':entity.knowledgepoint.section)+"</td><td>详情</td></tr>"; }); daohang+="第"+mydata.currentPage+"页 "; daohang+="共"+mydata.totalPage+"页 "; if(mydata.currentPage==1){ daohang+="第一页 上一页 "; } else{ daohang+="<a href='javascript:toPage(1,"+tp+")'>第一页</a> "; daohang+="<a href='javascript:toPage("+(mydata.currentPage-1)+","+tp+")'>上一页</a> "; } if(mydata.currentPage!=mydata.totalPage) { daohang+="<a href='javascript:toPage("+(mydata.currentPage+1)+","+tp+")'>下一页</a> "; daohang+="<a href='javascript:toPage("+(mydata.totalPage)+","+tp+")'>最后一页</a>"; } else{ daohang+="下一页 最后一页"; } if(tp==1) { $("#singleTable").html(info); $("#SingleDaoHang").html(daohang); } else if(tp==2) { $("#multiTable").html(info); $("#MultiDaoHang").html(daohang); } else if(tp==3) { $("#notConfirmTable").html(info); $("#NotConfirmDaoHang").html(daohang); } else if(tp==4) { $("#chooseTable").html(info);