/** 跳转的代码 **/
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='
\n' +
'
' +
'
' +
'
跳转
' +
'
' +
PageInfo+
'
' +
'
将跳转到' +
' ' +
'
' +
'
' +
' ' +
' ' +
'
' +
'
' +
'
' +
'
';
var jump_interface_error='
' +
'
' +
'
' +
'
错误提示
' +
'
' +
' ' +
'
' +
'
' +
' ' +
' ' +
'
' +
'
' +
'
' +
'
';
$("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");
};