标签:http os io 2014 re c cti ar
当页数比较多的时候我们需要加一个input框来跳转到某一分页中,比如这个框 id="tiaozhuan",接下来我们用JS实现跳转
//分页跳转
$("#tiaozhuan").bind("blur",function(){
var p = $(this).val();
var href = location.href;
if(/p=\d+/.test(href)){
href = href.replace(/p=\d+/,"p="+p);
}else if(href.indexOf(‘?‘)==-1){
href = href+"?p="+p
}else{
href = href+"&p="+p
}
location.href = href;
});
//绑定回车事件
$("#tiaozhuan").bind("keydown",function(event){
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode==13){
$("#tiaozhuan").trigger(‘blur‘);
}
});
标签:http os io 2014 re c cti ar
原文地址:http://my.oschina.net/tongjh/blog/294782