자스로 만든 페이징 > script

본문 바로가기
사이트 내 전체검색

script

자스로 만든 페이징

페이지 정보

작성자 서방님 댓글 0건 조회 176회 작성일 06-09-14 16:05

본문

페이징이라기보단 페이지 네비게이션쯤된다고 해야하나. 그런거 같습니다.
innerText을 쓰면 파폭에서 안되는거 같아서리 한번 만들어봤구요. 제가 자스를 못해서 코드가 약간 추잡스럽습니다. 이해해주시길 초보용이라고 보시면 편할듯.
만들게된 동기는 프렛폼에 상관없이 되는 페이징을 만들려다가 보니까 만들게 됬고요.
원래는 ASP에 맞게 만들어논건데요. PHP에서 잘되는건 확인 했습니다.
제가 원래 게시판을 ASC형태로 정렬을 해서 DESC에서 잘될런지는 모르겠습니다.
너무 조잡해서 돌맞을지 모르겠네요 -_-;;; 초보니까 너무 심한욕은 삼가해주세요.
소심합니다.

나름 쓸만한거 같기도 해서 올려봅니다.

/*************************************************************************
작성자 : takumi(실명은 무서워요.!!)
작성일 : 2006년 6월3일
스크립트명 : 게시판 페이징 스크립트
*************************************************************************/
<!--
function pageSplit() {
    var pageUrl = "./board_list.asp";

    //페이지 최대크기를 제한한다.
    if((this.startnum + this.navisize) > this.pagecount){
        var maxLen = (this.pagecount + 1);
    }else{
        var maxLen = (this.startnum + this.navisize);
    }

    //맨처음 페이지로 가기
    if((this.startnum - this.navisize) < 1){
        document.write(this.firstimg);
    }else{
        if(this.keyword ==""){
            document.write("<A href =" + pageUrl + "?pagenum=" + 1 + ">" + this.firstimg + "</A> ");
        }else{
            document.write("<A href =" + pageUrl + "?pagenum=" + 1 + "&search=" + this.search+ "&keyword=" + this.keyword + ">" + this.firstimg + "</A> ");
        }
    }

    //지정된 이전 개수로 가기
    if((this.startnum - this.navisize) < 1){
        document.write(this.previousimg);
    }else{
        if(this.keyword ==""){
            document.write("<A href =" + pageUrl + "?pagenum=" + (this.startnum - this.navisize) + ">" + this.previousimg + "</A> ");
        }else{
            document.write("<A href =" + pageUrl + "?pagenum=" + (this.startnum - this.navisize) + "&search=" + this.search+ "&keyword=" + this.keyword + ">" + this.previousimg + "</A> ");
        }
    }

    //숫자 뿌리기
    for(i = this.startnum; i < maxLen; i++){
        //선택된페이지 링크를 없게만듬
        if(i == this.disablenum){
            document.write("<b>" + i + "</b>" + " ");

        //페이지 번호를 찍어준다.
        }else if(this.disablenum < this.pagecount){
            //검색일경우와 아닐경우 링크를 다르게 한다.
            if(this.keyword ==""){
                document.write("<A href =" + pageUrl + "?pagenum=" + i + ">" + i + "</A> ");
            }else{
                document.write("<A href =" + pageUrl + "?pagenum=" + i + "&search=" + this.search+ "&keyword=" + this.keyword + ">" + i + "</A> ");
            }
        }else{
            //검색일경우와 아닐경우 링크를 다르게 한다.
            if(this.keyword ==""){
                document.write("<A href =" + pageUrl + "?pagenum=" + i + ">" + i + "</A> ");
            }else{
                document.write("<A href =" + pageUrl + "?pagenum=" + i + "&search=" + this.search+ "&keyword=" + this.keyword + ">" + i + "</A> ");
            }
        }
    }

    //지정된 다음 개수로 가기
    if((this.startnum + this.navisize) > this.pagecount){
        document.write(this.nextimg);
    }else{
        if(this.keyword ==""){
            document.write("<A href =" + pageUrl + "?pagenum=" + (this.startnum + this.navisize) + ">" + this.nextimg + "</A> ");
        }else{
            document.write("<A href =" + pageUrl + "?pagenum=" + (this.startnum + this.navisize) + "&search=" + this.search+ "&keyword=" + this.keyword + ">" + this.nextimg + "</A> ");
        }
    }

    //마지막 페이지로가기
    if((this.startnum + this.navisize) > this.pagecount){
        document.write(this.lastimg);
    }else{
        if(this.keyword ==""){
            document.write("<A href =" + pageUrl + "?pagenum=" + this.pagecount + ">" + this.lastimg + "</A> ");
        }else{
            document.write("<A href =" + pageUrl + "?pagenum=" + this.pagecount + "&search=" + this.search+ "&keyword=" + this.keyword + ">" + this.lastimg + "</A> ");
        }

    }
}
//-->
/***********************************************************************************************************
파라미터 : 총글의개수,총페이지수,시작점,네비게이션크기,비활성화될숫자,검색타입,검색어,처음이미지,이전이미지,다음이미지,마지막이미지
***********************************************************************************************************/
<!--
function pageParameter(recordcount, pagecount, startnum, navisize, disablenum, search, keyword, firstimg, previousimg, nextimg, lastimg) {

    this.recordcount = recordcount;
    this.pagecount = pagecount;
    this.startnum = startnum;
    this.navisize = navisize;
    this.disablenum = disablenum;
    this.search = search;
    this.keyword = keyword;
    this.firstimg = firstimg;
    this.previousimg = previousimg;
    this.lastimg = lastimg
    this.nextimg = nextimg;
    this.pageSplit = pageSplit;

}
//-->
/***********************************************************************************************************
객체 생성후 파라미터를 이용한접근
outPut = new pageParameter(<%=recordcount%>, <%=pagecount%>, <%=startnum%>, <%=navisize%>, <%=disablenum%>, "<%=search%>", "<%=keyword%>",
"처음", "이전", "다음", "마지막");
outPut.pageSplit();
***********************************************************************************************************/

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
120
어제
225
최대
1,347
전체
154,879
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.