page.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. function goToURL() { // v3.0
  2. var i, args = goToURL.arguments;
  3. document.location = args[0];
  4. }
  5. function toQuery() {
  6. toFirst();
  7. }
  8. function toFirst() {
  9. var pageSize = document.getElementById("pageSize").value;
  10. var curPage = document.getElementById("curPageNum");
  11. curPage.value = 1;
  12. // document.pageForm.action =
  13. // document.getElementById("searchFormName").value;
  14. document.pageForm.submit();
  15. return true;
  16. }
  17. function toPre() {
  18. var pageSize = document.getElementById("pageSize").value;
  19. var curPage = document.getElementById("curPageNum");
  20. var curPageNum = document.getElementById("curPageNum").value;
  21. var curPage = document.getElementById("curPageNum");
  22. if (curPage.value > 1) {
  23. curPage.value = curPageNum - 1;
  24. }
  25. // document.pageForm.action =
  26. // document.getElementById("searchFormName").value;
  27. document.pageForm.submit();
  28. }
  29. function toNext() {
  30. var pageSize = document.getElementById("pageSize").value;
  31. var curPage = document.getElementById("curPageNum");
  32. var curPageNum = document.getElementById("curPageNum").value;
  33. var totalPageNum = document.getElementById("totalPageNum").value;
  34. if (curPageNum < new Number(totalPageNum)) {
  35. document.getElementById("curPageNum").value = new Number(curPageNum)
  36. + 1;
  37. }
  38. // alert("1");
  39. // alert(document.getElementById("url").value+"?pageSize="+pageSize+"&curPageNum="+curPage.value);
  40. // document.pageForm.action =
  41. // document.getElementById("searchFormName").value;
  42. document.pageForm.submit();
  43. }
  44. function toLast() {
  45. var pageSize = document.getElementById("pageSize").value;
  46. var curPage = document.getElementById("curPageNum");
  47. var totalPageNum = document.getElementById("totalPageNum").value;
  48. document.getElementById("curPageNum").value = totalPageNum;
  49. // document.pageForm.action =
  50. // document.getElementById("searchFormName").value;
  51. document.pageForm.submit();
  52. }
  53. function toGo() {
  54. // alert("pager.go");
  55. var totalPageNum = document.getElementById("totalPageNum").value;
  56. var goPageNum = document.getElementById("toPageNum");
  57. var goPageNumValue = goPageNum.value;
  58. var pageSize = document.getElementById("pageSize").value;
  59. var curPage = document.getElementById("curPageNum");
  60. alert(document.getElementById("j_productType").value);
  61. if (goPageNumValue > 0 && goPageNumValue <= new Number(totalPageNum)) {
  62. document.getElementById("curPageNum").value = document
  63. .getElementById("toPageNum").value;
  64. } else {
  65. goPageNum.value = document.getElementById("curPageNum").value;
  66. alert("��������Чҳ��!");
  67. return false;
  68. }
  69. // document.pageForm.action =
  70. // document.getElementById("searchFormName").value;
  71. document.pageForm.submit();
  72. }
  73. function setParam() {
  74. var args = setParam.arguments;
  75. // alert(args[0]);
  76. // alert(document[args[0]].action);
  77. // document.userListForm.action=document.userListForm.action+"?topage="+args[0];
  78. document[args[0]].action = document[args[0]].action + "?topage=" + args[1];
  79. return true;
  80. }
  81. function setClass(eleName, clsName) {
  82. document.all(eleName).className = clsName;
  83. }
  84. /*
  85. * function swapArrow(){ var cur = parseInt(document.all('currPage').value); var
  86. * total = parseInt(document.all('totalPage').value);
  87. *
  88. * var objSpanFirst = document.all('first'); var objSpanPrev =
  89. * document.all('pre'); var objSpanNext = document.all('next'); var objSpanLast =
  90. * document.all('last');
  91. *
  92. * if(total==1)//ȫ�������� { //ȫ�������� objSpanFirst.className='ArrowFirstGray
  93. * ArrowCommon'; objSpanPrev.className ='ArrowPrevGray ArrowCommon';
  94. * objSpanNext.className ='ArrowNextGray ArrowCommon'; objSpanLast.className
  95. * ='ArrowLastGray ArrowCommon'; } if(total>1 && cur==1) { //ǰ��ҳ������
  96. * objSpanFirst.className='ArrowFirstGray ArrowCommon'; objSpanPrev.className
  97. * ='ArrowPrevGray ArrowCommon'; objSpanNext.className ='ArrowNextLite
  98. * ArrowCommon'; objSpanLast.className ='ArrowLastLite ArrowCommon'; }
  99. * if(total>1 && cur>1 && cur<total) { //ȫ������
  100. * objSpanFirst.className='ArrowFirstLite ArrowCommon'; objSpanPrev.className
  101. * ='ArrowPrevLite ArrowCommon'; objSpanNext.className ='ArrowNextLite
  102. * ArrowCommon'; objSpanLast.className ='ArrowLastLite ArrowCommon'; }
  103. * if(total>1 && cur==total) { //��ҳ������
  104. * objSpanFirst.className='ArrowFirstLite ArrowCommon'; objSpanPrev.className
  105. * ='ArrowPrevLite ArrowCommon'; objSpanNext.className ='ArrowNextGray
  106. * ArrowCommon'; objSpanLast.className ='ArrowLastGray ArrowCommon'; } }
  107. */
  108. function KeyIsNumber(KeyCode) {
  109. // ���������ַ�����0-9֮�䣬������backspace��DEL��
  110. if (((KeyCode > 47) && (KeyCode < 58)) || (KeyCode == 8) || (KeyCode == 46)) {
  111. return true;
  112. } else {
  113. return false;
  114. }
  115. }
  116. function invalidateKey() {
  117. var keyCode = event.keyCode;
  118. if (keyCode == 13) {
  119. event.returnValue = false;
  120. // document.getElementById(event.srcElement.id).focus();
  121. }
  122. if (!KeyIsNumber(keyCode)) {
  123. return false;
  124. }
  125. }