js实现翻页功能

来源:岁月联盟 编辑:exp 时间:2011-08-23

#create ydds
#date 2008-06-20
var nextPageNo = 0;
function pageTop(){
    nextPageNo = 0
    document.getElementById("bodyDiv").innerHTML = HTMLStr[nextPageNo];
    loadData('bodyDiv');
    checkTime();
}
function pageNext(){
    if (nextPageNo < HTMLStr.length - 1)
        nextPageNo++;
    document.getElementById("bodyDiv").innerHTML = HTMLStr[nextPageNo];
    loadData('bodyDiv');
    checkTime();
}
function pageFor(){
    if (nextPageNo > 0)
        nextPageNo--;
    document.getElementById("bodyDiv").innerHTML = HTMLStr[nextPageNo];
    loadData('bodyDiv');
    checkTime();
}
function pageBottom(){
    nextPageNo = HTMLStr.length - 1;
    document.getElementById("bodyDiv").innerHTML = HTMLStr[nextPageNo];
    loadData('bodyDiv');
    checkTime();
}
function goPage(){
    var numStr = document.getElementById("InputNo").value;
    if (numStr == undefined || numStr == null) {
        return;
    }
    var num = parseInt(numStr);
    if (num > HTMLStr.length) {
        nextPageNo = HTMLStr.length - 1;
    }
    else {
        nextPageNo = num - 1;
    }
    document.getElementById("bodyDiv").innerHTML = HTMLStr[nextPageNo];
    loadData('bodyDiv');
    checkTime();
}
本文出自 “一灯” 博客