function enterGoPage(obj, event) { var event = event ? event : (window.event ? window.event : null); if (event.keyCode == 13) { goPageFun(obj); } } function goPageFun(obj) { var goPageId = obj.getAttribute("goPageId"); var page = document.getElementById(goPageId + "goPage").value; var totalPage = obj.getAttribute("totalPage"); var callBack = obj.getAttribute("callBack"); page = page.replace(/(^[\s]*)|([\s]*$)/g, ""); if (page == "" || page <= 0 || isNaN(page)) { alert("请输入有效的页!"); return false; } if (page > totalPage) { page = totalPage; } eval(callBack + "(" + page + ")");; } function appendPageHtml(id, currentPage, totalPage, callBack) { var comments = "
"; if (currentPage > 1) { comments += "首页"; comments += "上一页"; } else { comments += "首页 上一页"; } comments += ""; if (currentPage < totalPage) { comments += "下一页"; comments += "尾页"; } else { comments += "下一页尾页"; } comments += ""; comments += ""; comments += "
"; document.getElementById(id).innerHTML = comments; }