<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>addUser.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../js/wpCalendar.js">
style="border: 1px red solid; margin-bottom: 100px; padding: 10px 10%">
<table border="1px" cellpadding="0" cellspacing="0" id="tusers">
<input type="checkbox" name="chbk" id="chbk1" />
<div style="border: 1px blue solid;">
<input type="text" name="name" id="name" />
<input type="text" name="email" id="email" />
<input type="text" id="bir" name="bir" />
<input type=button value="点击看我"
οnclick="showCalendar(this,document.all.bir)">
<input type="button" value="添加" οnclick="addUser()" id="add" />
<input type="button" value="修改" id="upduser" />
window.onload = function() {
document.getElementByIdx_x("addu1").style.display = "none";
var name = document.getElementByIdx_x("name").value;
var sex = document.getElementByIdx_x("sex").value;
var email = document.getElementByIdx_x("email").value;
var bir = document.getElementByIdx_x("bir").value;
var tusers = document.getElementByIdx_x("tusers");
var tr1 = document.createElement_x("tr");
var cbk = document.createElement_x("td");
var tname = document.createElement_x("td");
var tsex = document.createElement_x("td");
var temail = document.createElement_x("td");
var tbir = document.createElement_x("td");
var toper = document.createElement_x("td");
var cbk1 = document.createElement_x("input");
cbk1.setAttribute("type", "checkbox");
cbk1.setAttribute("name", "chbk");
tname.appendChild(document.createTextNode(name));
tsex.appendChild(document.createTextNode(sex));
temail.appendChild(document.createTextNode(email));
tbir.appendChild(document.createTextNode(bir));
var adelete = document.createElement_x("a");
var aupdate = document.createElement_x("a");
adelete.setAttribute("href", "#");
aupdate.setAttribute("href", "#");
adelete.appendChild(document.createTextNode("删除 |"));
aupdate.appendChild(document.createTextNode("修改"));
toper.appendChild(adelete);
toper.appendChild(aupdate)
var users = document.getElementByIdx_x("users");
tusers.appendChild(users);
adelete.onclick = function() {
users.removeChild(adelete.parentNode.parentNode);
aupdate.onclick = function() {
document.getElementByIdx_x("addu").style.display = "none";
document.getElementByIdx_x("addu1").style.display = "block";
var utr = aupdate.parentNode.parentNode;
var utrs = utr.childNodes;
document.getElementByIdx_x("name").value = utrs[1].innerHTML;
document.getElementByIdx_x("sex").value = utrs[2].innerHTML;
document.getElementByIdx_x("email").value = utrs[3].innerHTML;
document.getElementByIdx_x("bir").value = utrs[4].innerHTML;
var upUser = document.getElementByIdx_x("upduser");
upUser.onclick = function() {
utr.childNodes[1].innerHTML = document.getElementByIdx_x("name").value;
utr.childNodes[2].innerHTML = document.getElementByIdx_x("sex").value;
utr.childNodes[3].innerHTML = document.getElementByIdx_x("email").value
utr.childNodes[4].innerHTML = document.getElementByIdx_x("bir").value
document.getElementByIdx_x("addu1").style.display = "none";
document.getElementByIdx_x("addu").style.display = "block";
var indexPage = document.createElement_x("a");
var upPage = document.createElement_x("a");
var downPage = document.createElement_x("a");
var endPage = document.createElement_x("a");
var tbodyUsers = document.getElementByIdx_x("users");
var trUsers = tbodyUsers.getElementsByTagName_r("tr");
var countRecord = trUsers.length;
var countPage = (countRecord % PAGESIZE == 0 ? countRecord / PAGESIZE
: Math.ceil(countRecord / PAGESIZE));
// =======>从那条记录开始 (nowpage-1)*PAGESIZE;
//var nowpage = countPage;
var pages = document.getElementByIdx_x("pages");
if (!pages.hasChildNodes()) {
indexPage.onclick = function() {
indexPageInfo(countRecord, trUsers);
upPage.onclick = function() {
indexPageInfo(countRecord, trUsers);
var startindex = (nowpage - 1) * PAGESIZE;
alert(startindex + "====================++++++");
var endindex = startindex + PAGESIZE;
PageInfo(startindex, endindex, countRecord, trUsers)
downPage.onclick = function() {
if (nowpage + 1 >= countPage) {
alert(nowpage + "-----------------");
var startindex = (nowpage - 1) * PAGESIZE;
alert(startindex + "====================++++++");
var endindex = startindex + PAGESIZE;
alert(startindex + "-----" + endindex + "---");
PageInfo(startindex, endindex, countRecord, trUsers)
endPage.onclick = function() {
var startindex = (nowpage-1)*PAGESIZE;
for ( var i = 0; i < countRecord; i++) {
trUsers[i].style.display = "none";
trUsers[i].style.display = "block";
<script language="JavaScript">
var totalRecordNum = <%=totalRecordNum%>;//总记录条数(从java程序中获取)
var currentPageNumber = 1;//当前页号
var perPageRecordNum = 5;//每页记录条数(js中设置)
var totalPageNumber = Math.ceil(totalRecordNum/perPageRecordNum);
var startShowPage ;//开始显示页记录号数
var endShowPage ;//结束显示页记录号数
var pageNo = document.BillQueryForm.pageNum.value;
if((/[^0-9]/gi.test(pageNo)) | pageNo.length==0)
if((pageNo > totalPageNumber)|(pageNo<1))
startShowPage = (pageNo-1)*perPageRecordNum;
endShowPage = pageNo*perPageRecordNum;
currentPageNumber = pageNo;
curPageNo.innerHTML = currentPageNumber;
totalPageNo.innerHTML = totalPageNumber;
startShowPage = 0*perPageRecordNum;
endShowPage = 1*perPageRecordNum;
curPageNo.innerHTML = currentPageNumber;
totalPageNo.innerHTML = totalPageNumber;
if(totalRecordNum%perPageRecordNum==0)//除尽
var tempVal = totalRecordNum/perPageRecordNum;
startShowPage = (tempVal-1)*perPageRecordNum;
endShowPage = tempVal*perPageRecordNum;
var tempVal = totalRecordNum%perPageRecordNum;//得到余数,就是最后一页要显示的记录条数
startShowPage = totalRecordNum-tempVal;
endShowPage = totalRecordNum;
currentPageNumber=totalPageNumber;
curPageNo.innerHTML = currentPageNumber;
totalPageNo.innerHTML = totalPageNumber;
if(currentPageNumber< totalPageNumber)
currentPageNumber = Number(currentPageNumber)+1;
startShowPage = (currentPageNumber-1)*perPageRecordNum;
endShowPage = currentPageNumber*perPageRecordNum;
curPageNo.innerHTML = currentPageNumber;
totalPageNo.innerHTML = totalPageNumber;
function goToBeforePage()
currentPageNumber = currentPageNumber-1;
startShowPage = (currentPageNumber-1)*perPageRecordNum;
endShowPage = currentPageNumber*perPageRecordNum;
curPageNo.innerHTML = currentPageNumber;
totalPageNo.innerHTML = totalPageNumber;
for(var i = 0; i<totalRecordNum;i++)
if ((i>=startShowPage)&&(i<endShowPage))
document.getElementByIdx_x("row"+i).style.display="";
document.getElementByIdx_x("row"+i).style.display="none";
var sForm = document.JXCardNumQueryForm;
if(sForm.elements["jxCardVO.jxcardid"].value==""){
sForm.elements["jxCardVO.jxcardid"].focus();
if(sForm.elements["jxCardVO.password"].value==""){
sForm.elements["jxCardVO.password"].focus();
sForm.action="jxCardNumQuery.do?type=dxk";
if(document.all("card_no").value==""){
document.all("card_no").focus();
if(document.all("password").value==""){
document.all("password").focus();
<body onLoad="javascript:goToFirstPage();">
<%if(totalRecordNum!=0) {%>
<td colspan='4' align="right">
当前第<span id="curPageNo"></span>页/总计<span id="totalPageNo"></span>页
<a onClick="javascript:goToFirstPage();" style="cursor:hand;"><img src="images/page_top.gif" width="9" height="9" border="0">第一页</a>
<a onClick="javascript:goToBeforePage();" style="cursor:hand;"><img src="images/page_prev.gif" width="9" height="9" border="0">上一页</a>
<a onClick="javascript:goToNextPage();" style="cursor:hand;">下一页<img src="images/page_next.gif" width="9" height="9"></a>
<a onClick="javascript:goToLastPage();" style="cursor:hand;">最后一页<img src="images/page_end.gif" width="9" height="9" border="0"></a>
<input type="text" id="pageNum" name="pageNum" size="5" οnkeydοwn="javascript:keyDown();">
<input type="button" class="orangebtn_s" value="Go!" οnclick="javascript:goToPage();" />
<td colspan='4' align="right">
<span id="curPageNo"></span>
<span id="totalPageNo"></span>
若转载请注明出处!若有疑问,请回复交流!