U.Page.htm 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title></title>
  5. <!-- <script type="text/javascript"> document.domain = "1473.cn";</script>-->
  6. <script src="http://www.1473.cn/uform.js" type="text/javascript"></script>
  7. <style>
  8. body{margin:0px; padding:0px;}
  9. .U_P_Y_Box {width:900px; height:36px;}
  10. .U_P_T_left{ margin:14px auto; background-position:-5px -5px; width:6px; height:9px; background-image:url(photo/2.png); background-repeat:no-repeat; -webkit-transform:scaleX(-1);}
  11. .U_P_T_left2{ margin:14px auto; background-position:-5px -43px; width:6px; height:9px; background-image:url(photo/2.png); background-repeat:no-repeat; -webkit-transform:scaleX(-1);}
  12. .U_P_Y_pageitem{width:36px; height:36px; color:#666; border:1px solid #e8e8e8;}
  13. .U_P_Y_page{width:36px; height:36px; color:#666; border:1px solid #e8e8e8; text-align:center; float:left; line-height:36px;}
  14. .U_P_T_right{margin:14px auto; background-position:-5px -5px; width:6px; height:9px; background-image:url(photo/2.png); background-repeat:no-repeat; }
  15. .U_P_T_right2{margin:14px auto; background-position:-5px -43px; width:6px; height:9px; background-image:url(photo/2.png); background-repeat:no-repeat; }
  16. .U_P_Y_DUO {width:36px; height:36px; color:#666;float:left; line-height:36px; text-align:center;}
  17. .U_P_Y_page:hover{width:36px; height:36px; color:#666; border:1px solid #f40; color:#f40;}
  18. .U_P_Y_pageground {width:36px; height:36px; color:#fff; border:1px solid #f40; text-align:center; float:left; line-height:36px;background:#f40;}
  19. .U_P_Y_font {color:#666; font-size:14px; float:left; margin:10px 0px 0px 10px;}
  20. .U_P_Y_Text{vertical-align:middle; text-align:center; width:40px; height:15px; margin:8px 0px 0px 0px; float:left;}
  21. .U_P_Y_Ar {width:50px; height:19px; background:#f40; color:#fff; font-size:14px; float:left; margin:8px 0px 0px 0px; text-align:center; display:none;}
  22. </style>
  23. <script>
  24. U.PAG = function () { }
  25. U.PAG.prototype = {
  26. init: function (config) { //初始化数据
  27. this.U_P_C_Page = 1; // 当前页
  28. this.U_P_C_PageData = config.PageData; //当前页数据 默认10
  29. this.U_P_C_TotalData = config.Arr.Title.length; // 总数据
  30. this.U_P_C_TotalPage = Math.ceil(this.U_P_C_TotalData / this.U_P_C_PageData); //总页数
  31. this.Array = config.Arr; //数组里面的东西
  32. this.LV();
  33. },
  34. LV: function () {
  35. var U_P_D_Box = $$("div", { "className": "U_P_Y_Box" }, document.body);
  36. var asr = this.U_P_C_TotalData - this.U_P_C_PageData * (this.U_P_C_Page - 1);
  37. var qqq = this.U_P_C_Page == this.U_P_C_TotalPage ? asr : this.U_P_C_PageData;
  38. for (var i = 0; i < qqq; i++) {
  39. var as = this.U_P_C_PageData * (this.U_P_C_Page - 1);
  40. var a = $$("div", { "innerHTML": this.Array.Title[as + i] }, U_P_D_Box);
  41. }
  42. var U_P_D_Total = $$("div", { "className": "U_P_Y_page", "onclick": [[this.selectPage, ([this, 'left'])]] }, U_P_D_Box);
  43. var U_P_D_Bleft = $$("div", { "className": this.U_P_C_Page == 1 ? "U_P_T_left2" : "U_P_T_left" }, U_P_D_Total);
  44. if (this.U_P_C_TotalPage <= 6) {
  45. for (var i = 1; i <= this.U_P_C_TotalPage; i++) {
  46. var U_P_D_Total = $$("div", { "className": this.U_P_C_Page == i ? "U_P_Y_pageground" : "U_P_Y_page" }, U_P_D_Box);
  47. var U_P_D_Bleft = $$("div", { "innerHTML": i, "onclick": [[this.selectPage, ([this])]] }, U_P_D_Total);
  48. }
  49. } else {
  50. if (this.U_P_C_Page <= 3) {
  51. for (var i = 1; i < 7; i++) {
  52. var U_P_D_Total = $$("div", { "className": this.U_P_C_Page == i ? "U_P_Y_pageground" : "U_P_Y_page" }, U_P_D_Box);
  53. var U_P_D_Bleft = $$("div", { "innerHTML": i, "onclick": [[this.selectPage, ([this])]] }, U_P_D_Total);
  54. }
  55. }
  56. else {
  57. var start = parseInt(this.U_P_C_Page) - 3;
  58. var end = parseInt(this.U_P_C_Page) + 3;
  59. if (end > this.U_P_C_TotalPage) {
  60. end = this.U_P_C_TotalPage;
  61. start = end - 6;
  62. }
  63. for (var i = start; i <= end; i++) {
  64. var U_P_D_Total = $$("div", { "className": this.U_P_C_Page == i ? "U_P_Y_pageground" : "U_P_Y_page" }, U_P_D_Box);
  65. var U_P_D_Bleft = $$("div", { "innerHTML": i, "onclick": [[this.selectPage, ([this])]] }, U_P_D_Total);
  66. }
  67. }
  68. if (this.U_P_C_Page >= (this.U_P_C_TotalPage - 3)) { } else {
  69. var U_P_D_Total = $$("div", { "className": "U_P_Y_DUO" }, U_P_D_Box);
  70. var U_P_D_Bleft = $$("div", { "innerHTML": "..." }, U_P_D_Total);
  71. }
  72. }
  73. var U_P_D_Total = $$("div", { "className": "U_P_Y_page", "onclick": [[this.selectPage, ([this, 'right'])]] }, U_P_D_Box);
  74. var U_P_D_Bleft = $$("div", { "className": this.U_P_C_Page == this.U_P_C_TotalPage ? "U_P_T_right2" : "U_P_T_right" }, U_P_D_Total);
  75. var U_P_Y_ParaTotaly = $$("div", { "innerHTML": "共" + this.U_P_C_TotalPage + "页", "className": "U_P_Y_font" }, U_P_D_Box);
  76. var U_P_Y_Fly = $$("div", { "innerHTML": "去第", "className": "U_P_Y_font" }, U_P_D_Box);
  77. var U_P_Y_Text = $$("input", { "value": this.U_P_C_Page, "type": "text", "className": "U_P_Y_Text", "onclick": [[this.blo, ([this])]] }, U_P_D_Box);
  78. var U_P_Y_Ar = $$("div", { "innerHTML": "确定", "className": "U_P_Y_Ar", "onclick": [[this.Fly, ([this])]] }, U_P_D_Box);
  79. var U_P_Y_Fly = $$("div", { "innerHTML": "页", "className": "U_P_Y_font" }, U_P_D_Box);
  80. document.onclick = (function (that) {
  81. return function () {
  82. var e = event || window.event;
  83. var aim = e.srcElement || e.target;
  84. if (e.srcElement) {
  85. var aim = e.srcElement;
  86. if (aim != U_P_Y_Text) {
  87. that.U_P_Y_Ar.style.display = "none";
  88. } else {
  89. var aim = e.target;
  90. if (aim != U_P_Y_Text) {
  91. that.U_P_Y_Ar.style.display = "none";
  92. }
  93. }
  94. }
  95. }
  96. })(this);
  97. this.U_P_Y_Text = U_P_Y_Text;
  98. this.U_P_Y_Ar = U_P_Y_Ar;
  99. this.U_P_D_Box = U_P_D_Box;
  100. },
  101. selectPage: function (that, n) {
  102. if (n == 'left') {
  103. if (that.U_P_C_Page == 1) {
  104. return false;
  105. } else {
  106. that.U_P_C_Page--;
  107. }
  108. } else if (n == 'right') {
  109. if (that.U_P_C_Page == that.U_P_C_TotalPage) {
  110. return false;
  111. } else {
  112. that.U_P_C_Page++;
  113. }
  114. } else {
  115. if (n) { that.U_P_C_Page = n; }
  116. else { that.U_P_C_Page = this.innerHTML; }
  117. }
  118. document.body.removeChild(that.U_P_D_Box);
  119. that.LV();
  120. },
  121. blo: function (that) {
  122. that.U_P_Y_Ar.style.display = "block";
  123. },
  124. Fly: function (that) {
  125. if (that.U_P_Y_Text.value > that.U_P_C_TotalPage) {
  126. return false;
  127. }
  128. that.selectPage(that, that.U_P_Y_Text.value);
  129. }
  130. }
  131. </script>
  132. <script type="text/javascript">
  133. window.onload = function () {
  134. var Array = {
  135. "Title": ["电脑", "冰箱", "手机", "空调", "灯泡", "玩具", "黑板", "本子", "被子", "杯子", "我", "蛋蛋", "我是", "徐杰风", "踩踩踩", "二厅", "无人", "离开码头", "问题", "无人", "太卡", "刘恺威", "了", "无污染"],
  136. "Content": ["这是内容", "这是内容", "这是内容", "这是内容", "这是内容", "这是内容", "这是内容", "这是内容", "这是内容", "这是内容", "我最想", "中文"]
  137. };
  138. var _C = new U.PAG();
  139. _C.init({
  140. PageData: 10, // 每页数据
  141. Arr: Array//总数据
  142. });
  143. }
  144. </script>
  145. </head>
  146. <body>
  147. </body>
  148. </html>