123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- /** 跳转的代码 **/
- var oldContent= $("#head").attr("content");
- var content="width=device-width, initial-scale=1,maximum-scale=10,minimum-scale=0.1,user-scalable=no";
- var pageCount = parseInt($(".get_page_count").html());
- var Page = parseInt($(".get_page").html());
- var PageInfo = $(".get_page_info").html();
- var error = ['已经是第一页了', '已经是最后一页了', '跳转页数超出的范围', '已经在当前页了无需跳转'];
- var jump_interface_page='<div class="jump-interface jump-interface-page none">\n' +
- ' <div class="jump-box">' +
- ' <ul>' +
- ' <li class="tip">跳转</li>' +
- ' <li>' +
- PageInfo+
- ' </li>' +
- ' <li>将跳转到' +
- ' <input class="jumpNumber" id="jumpNumber" type="text"' +
- ' value="1" onkeyup="checkLen2(this)" oninput="value=value.replace(/[^\\d]/g,\'\')">' +
- ' </li>' +
- ' <li class="jump-save-box">' +
- ' <button class="jump" id="jump">跳转</button>' +
- ' <button class="cancel" id="cancel">取消</button>' +
- ' </li>' +
- ' </ul>' +
- ' </div>' +
- '</div>';
- var jump_interface_error='<div class="jump-interface jump-interface-error none">' +
- ' <div class="jump-box">' +
- ' <ul>' +
- ' <li class="tip">错误提示</li>' +
- ' <li class="tip-content">' +
- ' <div id="tip-content-div"></div>' +
- ' </li>' +
- ' <li class="jump-save-box">' +
- ' <button class="jump" id="esure">确定</button>' +
- ' <button class="cancel" id="esure-cancel">取消</button>' +
- ' </li>' +
- ' </ul>' +
- ' </div>' +
- '</div>';
- $("body").append(jump_interface_page);
- $("body").append(jump_interface_error);
- //上一页
- document.getElementById("prev_btn").onclick = function () {
- skip(0);
- };
- //下一页
- document.getElementById("next_btn").onclick = function () {
- skip(1);
- };
- //跳转功能代码
- function skip(type) {
- var jumpNumber = Page;
- var errorBool = false;
- if (type == 0) {
- Page = Page - 1;
- if (Page < 1) {
- errorBool = true;
- }
- } else if (type == 1) {
- Page = Page + 1;
- if (Page > pageCount) {
- errorBool = true;
- }
- } else {
- var PageValue = document.getElementById("jumpNumber").value;
- if (typeof PageValue == "undefined" || PageValue == null || PageValue == "") {
- errorBool = true;
- } else {
- Page = parseInt(PageValue);
- if (Page == null || Page < 1 || Page > pageCount) {
- errorBool = true;
- }
- if (jumpNumber == Page) {
- type = 3;
- errorBool = true;
- }
- }
- }
- if (errorBool) {
- Page = jumpNumber;
- document.getElementById("tip-content-div").innerHTML = error[type];
- $(".condition-box").addClass("none");
- $("#head").attr("content",content);
- $(".jump-interface-error").removeClass("none");
- } else {
- url = location.href; //把当前页面的地址赋给变量 url
- var times = url.split("&page");
- if (times.length < 2) {
- url += ("&page=" + Page);
- } else {
- url = times[0] + ("&page=" + Page);
- }
- self.location.replace(url); //刷新页面
- }
- }
- //自定义键盘
- var coolInput = new CoolInput({slt: '#jumpNumber'});
- //跳转界面
- document.getElementById("jump-phone-img").onclick = function () {
- $(".condition-box").addClass("none");
- $("#head").attr("content",content);
- $(".jump-interface-page").removeClass("none");
- coolInput.cursorT=$("#jumpNumber").offset().top;
- };
- //跳转
- document.getElementById("jump").onclick = function () {
- $(".jump-interface-page").addClass("none");
- $("#head").attr("content",oldContent);
- $(".condition-box").removeClass("none");
- skip(2);
- };
- document.getElementById("cancel").onclick = function () {
- $(".jump-interface-page").addClass("none");
- $("#head").attr("content",oldContent);
- $(".condition-box").removeClass("none");
- };
- document.getElementById("esure").onclick = function () {
- $(".jump-interface-error").addClass("none");
- $("#head").attr("content",oldContent);
- $(".condition-box").removeClass("none");
- };
- document.getElementById("esure-cancel").onclick = function () {
- $(".jump-interface-error").addClass("none");
- $("#head").attr("content",oldContent);
- $(".condition-box").removeClass("none");
- };
|