function DHTMLpagenation(content){ 
    // client static html file pagenation 
    this.content=content;   
    this.contentLength=content.length;     
    this.pageSizeCount=1;     
    this.perpageLength=100;//default perpage by length. 
    this.currentPage=1;    //this.regularExp=/.+[\?\&]{1}page=(\d+)/; 
    this.regularExp=/\d+/;     
    this.divContentArray=new Array();     
    this.divDisplayContent;     
    this.contentStyle=null;     
    this.strDisplayContent="";     
    this.divDisplayPagenation;     
    this.strDisplayPagenation="";     
     
    arguments.length==2?perpageLength=arguments[1]:'';     
     
    try{ 
        divExecuteTime=document.createElement("DIV");         
        document.body.appendChild(divExecuteTime);         
    } 
    catch(e) 
    { 
    } 
    if(document.getElementById('divContent')) 
    { 
        divDisplayContent=document.getElementById('divContent');         
    } 
    else  
    { 
        try 
        { 
            divDisplayContent=document.createElement("DIV");             
            divDisplayContent.id="divContent";             
            document.body.appendChild(divDisplayContent);             
        } 
        catch(e) 
        { 
            return false;             
        } 
    } 
    if(document.getElementById('divPagenation')) 
    { 
        divDisplayPagenation=document.getElementById('divPagenation');         
    } 
    else  
    { 
        try 
        { 
            divDisplayPagenation=document.createElement("DIV");             
            divDisplayPagenation.id="divPagenation";             
            document.body.appendChild(divDisplayPagenation);             
        } 
        catch(e) 
        { 
            return false;             
        } 
    } 
    DHTMLpagenation.initialize();     
    return this;     
}; 
DHTMLpagenation.initialize=function (){ 
    divDisplayContent.className=contentStyle!=null?contentStyle:"divContent";     
    if(contentLength<=perpageLength) 
    { 
        strDisplayContent=content;         
        divDisplayContent.innerHTML=strDisplayContent;         
        return null;         
    } 
    var contentArr=new Array();     
    var contentArrTemp=new Array();     
    if(content.toUpperCase().indexOf("[NEXTPAGE]")>0) 
    { 
        contentArrTemp=content.split("[NEXTPAGE]");         
        pageSizeCount=contentArrTemp.length;         
        for(i=0;i<pageSizeCount;i++){ 
            contentArr[i+1]=contentArrTemp[i];             
        } 
    } 
    else  
    { 
    	  // 忽略大小写区别 匹配所有可能的字串 
        re=/<table[^>]*>[\s\S]*?<\/table>|<div[^>]*>[\s\S]*?<\/div>|<p[^>]*>[\s\S]*?<\/p>|.*/ig;         
         
        contentArray=content.match(re);    
        //alert(contentArray);  
        var str="";         
        for(i=0;i<contentArray.length;i++){ 
            if(str.length<=perpageLength ) 
            { 
                str=str+contentArray[i];     
            } 
            else  
            { 
                contentArr[pageSizeCount]=str;                 
                str=contentArray[i];   
                if(str.length>0)  
                pageSizeCount=pageSizeCount+1;                 
            } 
        } 
        if(str.length>0)
        	contentArr[pageSizeCount]=str;     
        //for(i=0;i<contentArr.length;i++){ 
        //	alert("-------" +i+ "" +contentArr[i]);
        //}
            
    } 
    divContentArray=contentArr;     
    DHTMLpagenation.goto(currentPage);     
    DHTMLpagenation.displayContent();     
}; 
DHTMLpagenation.displayPage=function (){ 
    strDisplayPagenation="分页：";     
    if(currentPage&&currentPage!=1) 
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.previous()">上一页</a>  ';     
    else  
    strDisplayPagenation+="上一页  ";     
    for(var i=1;i<=pageSizeCount;i++) 
    { 
        if(i!=currentPage) 
        strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.goto('+i+');">'+i+'</a>  ';         
        else  
        strDisplayPagenation+=i+"  ";         
    } 
    if(currentPage&&currentPage!=pageSizeCount) 
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.next()">下一页</a>  ';     
    else  
    strDisplayPagenation+="下一页  ";     
    divDisplayPagenation.innerHTML=strDisplayPagenation;     
}; 
DHTMLpagenation.previous=function (){ 
    DHTMLpagenation.goto(currentPage-1);     
}; 
DHTMLpagenation.next=function (){ 
    DHTMLpagenation.goto(currentPage+1);     
}; 
DHTMLpagenation.goto=function (iCurrentPage){ 
    startime=new Date();     
    if(regularExp.test(iCurrentPage)) 
    { 
        currentPage=iCurrentPage;         
        strDisplayContent=divContentArray[currentPage];         
    } 
    else  
    { 
        alert("page parameter error!");         
    } 
    DHTMLpagenation.displayPage();     
    DHTMLpagenation.displayContent();     
}; 
DHTMLpagenation.displayContent=function (){ 
    divDisplayContent.innerHTML=strDisplayContent;     
}; 
DHTMLpagenation.change=function (iPerpageLength){ 
    if(regularExp.test(iPerpageLength)) 
    { 
        DHTMLpagenation.perpageLength=iPerpageLength;         
        DHTMLpagenation.currentPage=1;         
        DHTMLpagenation.initialize();         
    } 
    else  
    { 
        alert("请输入数字");         
    } 
}; 