Pagecontainer限制

时间:2013-03-05 17:54:25

标签: javascript html

var currentPage = 1;

function page(pg)
{
    var els = document.getElementsByClassName("pagecontainer");
    for (var i = 0; i < els.length; i++)
    {
        var page_of_container = els[i].getAttribute("id");
        els[i].style.display = page_of_container  == pg ? 'block' : 'none';                    
    }

    currentPage = pg;
}

function prev()
{
    if (currentPage <= 1) return;

    page(currentPage -1);
}

function next()
{
    if (currentPage >= document.getElementsByClassName("pagecontainer").length) return;

    page(currentPage + 1);
}

我有这个js pagecontainer并且它运行良好但我需要通过使用DIV高度添加限制,

我该怎么做?

0 个答案:

没有答案