⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 public_page_bar_include1.js

📁 给大家提供一个理解笔记本电池的途径。详细讲解了笔记本电池的结构
💻 JS
字号:
//just for bbs.zol.com.cn,to produce page bar
//zhangcy 2006-3-5
var page,i,j,start,baseurl,end_page,last_page,last_page_url='',next_page,next_page_url='';
var gotopage=0;

var param_arr=location.href.split("_");
var end_arr=param_arr[param_arr.length-1].split(".");

if(location.href.indexOf("sub_") > 0){
    if(param_arr.length > 3){
        page=end_arr[0];    //当前页码
        baseurl=param_arr[0]+"_"+param_arr[1]+"_"+param_arr[2];
    }else{
        page=0;
        baseurl=param_arr[0]+"_"+param_arr[1]+"_"+end_arr[0];
    }
}else{
    if(param_arr.length > 2){
        page=end_arr[0];    //当前页码
        baseurl=param_arr[0]+"_"+param_arr[1];
    }else{
        page=0;
        baseurl=param_arr[0]+"_"+end_arr[0];
    }
}


page=parseInt(page);
start=page-3;   //当前页前显示8页

if(start < 0){
    start=0;
}

try{
    if(!start){
        end_page=(6>pages)?pages:6;
    }else{
        end_page=((2+page)>pages)?pages:(2+page);
    }

    //the page before current page is:
    if(page>1){
        last_page=page-1;
        if(last_page<=1){
            last_page_url=baseurl+'.html';
        }else{
            last_page_url=baseurl+"_"+last_page+'.html';
        }
    }

    //the page after current page is:
    if(page<pages && pages >1){
        if(page==0){
            next_page=2;
        }else{
            next_page=page+1;
        }
        next_page_url=baseurl+"_"+next_page+'.html';
    }

    content_str+="</td>";
    if(last_page_url.length > 10){
        content_str+="<td class='pagebar' nowrap width=17 align=center style=\"padding-top:3px;\">";
        content_str+="<a href='"+last_page_url+"' title='上一页' style=\"color:#000000;\">&lt;</A></td>";
    }
    //here to list the nums
    for(i=start;i<end_page;i++){
        j=i+1;
        content_str+="<td width=17 class='pagebar' align=center style='padding-top:3px;'>";
        if(j==page || (j==1 && page==0)){
            content_str+="<font color='#000000' style='text-decoration:underline;font-weight:bold;'>"+j+"</font>";
        }else if(i==0){
            content_str+="<a href='"+baseurl+".html' class='a_hei12'>"+j+"</a>";
        }else{
            content_str+="<a href='"+baseurl+"_"+j+".html' class='a_hei12'>"+j+"</a>";
        }
        content_str+="</tD>";
    }
    if(next_page_url.length > 10){
        content_str+="<td class='pagebar' nowrap width=15 align=center class='a_hei12' style=\"padding-top:3px;\">";
        content_str+="<a href='"+next_page_url+"' title='下一页' class='a_hei12'>&gt;</A>";
        content_str+="</td>";
    }

    content_str+="<td class='pagebar' nowrap width=4% align=center style=\"color:#0084E6;padding-top:3px;\">";
    if(pages > 1){
        content_str+='<a href="'+baseurl+"_"+pages+'.html" class="a_hei12">尾页</a>';
    }else{
        content_str+='<a href="'+baseurl+'.html" class="a_hei12">尾页</a>';
    }

    content_str+='</td>';
//	content_str+='<td align=left width=80 nowrap style="color:#000000;padding-left:4px;" class="pagebar">';
//    content_str+='跳转至<input type="text" name="page_jump" size=2 class=box onKeyDown="enterjump();" style="height:13;margin-left:1px;margin-right:1px;">页</td>';
//    content_str+='<td width=26 class="pagebar"><input type="button" style="width:25px;height:20px;" onClick="jumpTo();" value="go">';
//    content_str+='</td>';
    content_str+='<td nowrap class="pagebar" align=right style="padding-right:5px;">';
    content_str+='&nbsp;';
    if(page>1){
        content_str+='<a href="'+last_page_url+'" class="hei12b">上一页</a>';
    }
    if(page<pages && pages >1){
        content_str+='&nbsp;<a href="'+next_page_url+'" class="hei12b">下一页</a>';
    }
	
	content_str+='</td>';
    content_str+='<td nowrap align=right bgcolor=\'#F2F5F9\'>';
    content_str+='&nbsp;';
    //text ad 2006-7-18 added{{{
	//if(page < 1){
    content_str+='<a href="http://ad.cn.doubleclick.net/clk;105615405;17304761;v?http://dellstorecn.sg.dell.com/public/default.jsp?c=cn&s=dhs&l=cn&rflag=AP&aflag=A&siteid=ZOLtextlinkxps" target=_blank class=\'a_hei12\' style=\'color:#FF0000\'>双核本网上订购优惠2700,详情800-858-2339</a>';
    //content_str+='&nbsp;';
	//}

    content_str+='</td></tR>';
    content_str+='</table>';
	document.getElementById('page_bar_top').innerHTML=content_str;
	document.getElementById('page_bar').innerHTML=content_str;
}catch(e){}

//functions to jump page
//zhangcy 2006-3-11
function jumpTo(){
    var textobj=document.getElementsByName("page_jump");
    if(textobj[0].value){
        var goPage = textobj[0].value;
    }else{
        var goPage = textobj[1].value;
    }
    goPage=parseInt(goPage);
    if(!isNaN(goPage) && goPage > 0 && goPage <= pages){
        if(1==goPage){
            location.href=baseurl+".html";
        }else{
            location.href=baseurl+"_"+goPage+".html";
        }
    }else{
        alert("正确填些了页数?");
        document.getElementById('page_jump').focus();
    }
}

function enterjump(){
    if(window.event.keyCode==13){
        jumpTo();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -