日期:2012-05-04 浏览次数:20735 次
function reterPageStr($pageSize,$curPage,$countSql,$pagePara)
{
// 返回字符串 rsStartpageStr
if($rsResult=mysql_query($countSql)) $rsCount=mysql_result($rsResult,0,0) ;
$pageCount=ceil($rsCount/$pageSize);
if (!isset($curPage)) $curPage=1;
if($curPage<1) $curPage=1;
if($curPage>$pageCount) $curPage=$pageCount;
$rsStart=($curPage-1)*$pageSize;
$pageStr=outPageList($pageCount,$curPage,$pagePara);
$outStr=$rsStart."". $pageCount."".$pageStr."".$rsCount;
return $outStr;
}
function outPageList($pageCount,$curPage,$pagePara)
{
if($pageCount>1)
{
$pageListNum=10;
$step=5;
$pageStr="";
$prePage=$curPage-1;
$nextPage=$curPage+1;
$pageFromNum=$curPage-$step;
$pageToNum=$curPage+$step;
if($pageCount<$step)
{
$pageFromNum=1;
$pageToNum=$pageCount;
}elseif($pageCount<$pageListNum)
{
$pageFromNum=1;
$pageToNum=$pageCount;
}
elseif($pageToNum>$pageCount)
{
$pageToNum=$pageCount;
if(($pageToNum-$pageFromNum)<$pageListNum)
{
$pageFromNum=$pageToNum-$pageListNum+1;
}
}else
{
if($pageFromNum<1)
{
$pageFromNum=1;
$pageToNum=$curPage+$step-1;
}
}
$pageStr.='
<script language="javascript">
function fucCheckNUM(obj){
var patn = /^\d+(\.\d+)?$/;
if(!patn.test(obj.value))
{
obj.value="1";
return false;
}
return true;
}
function locationPage(url)
{
var pageNum=document.getElementById("curPage").value;
var urlto=url+"&curPage="+pageNum;
window.location=urlto;
}
script>
';
/*开始输出 */
$pa