디지털 수정 페이지

3305 단어 jspprototype
문자열 결합, StringBuffer.js
function StringBuffer(){
	this._String = new Array();
};
StringBuffer.prototype.append = function(str){
	this._String.push(str);
};

StringBuffer.prototype.toString = function(){	return this._String.join('');};

 
 
페이지는 숫자 페이지, 쇼를 표시합니다.jsp
 
	var str = new StringBuffer();
	var url = "student.0905?method=doFindAll";
	var cpageInt = ${page.pageNo};
	var totalInt = ${page.pageTotal};
	// ,    
	str.append("<div class=\"digg\">");
    str.append("[ ");   
    if (${page.pageTotal} == 1) {   
        str.append("<strong>1</strong> ");   
    } else {                       
        if (cpageInt > 1) { 
            // , “<< <”   
            //<<:    
            //<:    
            str.append("<a   href='"+url+"&pageNo=1"+"'>«</a> ");   
            str.append("<a href='"+url+"&pageNo=" + (cpageInt - 1));   
            str.append("'>‹</a> " );   
        }else{                             
            str.append("« ‹ " );   
        }   
           
        var v=(cpageInt-4)>0?(cpageInt-4):1;   
        var v1=(cpageInt+4)<totalInt?(cpageInt+4):totalInt;   
        if(v1==totalInt){   
            v=totalInt-10;  
            v= v<=0 ? 1: v; //prevent v would be negative
        }else if(v==1&&v1<totalInt){   
            v1=totalInt>10?10:totalInt;   
        } 
        

        
        //10    
        for (var i = v; i <= v1; i++) {   
            if (cpageInt == i) { //    
           	 str.append("<span class=\"current\">");  
             str.append(i);  
             str.append("</span>");                                  
            }else{  
            	 str.append("<span>");  
                str.append("<a href='"+url+"&pageNo=" + i +"'>" + i + "</a> ");  
                str.append("</span>"); 

                
            }                               
        }   
        // 1 , “> >>”   
        if (cpageInt<totalInt) {   
            //>>:    
            //>:    
            str.append("<a href='"+url+"&pageNo=" + (cpageInt + 1));   
            str.append("'>›</a> " );   
            str.append("<a href='"+url+"&pageNo=" + totalInt);   
            str.append("'>»</a> " );   
        }else{   
            str.append("› » " );   
        }   
    }   
    str.append("]"); 
    str.append("</div> "); 
        
str.append("</span>"); 
document.write(str.toString());

 

좋은 웹페이지 즐겨찾기