| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 964 人关注过本帖
标题:[求助]分页的问题为什么不显示第二页
取消只看楼主 加入收藏
sky_200828
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2005-7-5
收藏
 问题点数:0 回复次数:3 
[求助]分页的问题为什么不显示第二页

点击下一页 什么都不显示 为什么 ?我把代码贴出来 那位高人帮我看看



<!-- #INCLUDE FILE="conn1.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>信盈车辆查询系统</title>
<style>
td{
font-size:10pt;
}
</style>
</head>
<SCRIPT LANGUAGE="JavaScript">
//------------------------------------日期
var gdCtrl = new Object();
var goSelectTag = new Array();
var gcGray = "#83E9B8";
var gcToggle = "#E983E3";
var gcBG = "#C193BE";

var gdCurDate = new Date();
var giYear = gdCurDate.getFullYear();
var giMonth = gdCurDate.getMonth()+1;
var giDay = gdCurDate.getDate();
var giHour = gdCurDate.getHours();
var giMinute = gdCurDate.getMinutes();
var giSecond = gdCurDate.getSeconds();

function fPopCalendar(popCtrl, dateCtrl)
{
event.cancelBubble=true;
gdCtrl = dateCtrl;
fSetYearMon(giYear, giMonth);
var point = fGetXY(popCtrl);
with (VicPopCal.style)
{
left = point.x;
top = point.y+popCtrl.offsetHeight+1;
width = VicPopCal.offsetWidth;
height = VicPopCal.offsetHeight;
fToggleTags(point);
visibility = 'visible';
}
VicPopCal.focus();
}

function fSetDate(iYear, iMonth, iDay,iHour,iMinute,iSecond)
{
var sYear = "";
var sMonth = "";
var sDay = "";
var sHour = "";
var sMinute = "";
var sSecond = "";

sYear = iYear;
if(iMonth < 10)
sMonth = "0" + iMonth;
else
sMonth = iMonth;
if(iDay < 10)
sDay = "0" + iDay;
else
sDay = iDay;
if(iHour < 10)
sHour = "0" + iHour;
else
sHour = iHour;
if(iMinute < 10)
sMinute = "0" + iMinute;
else
sMinute = iMinute;
if(iSecond < 10)
sSecond = "0" + iSecond;
else
sSecond = iSecond;
gdCtrl.value = sYear+"-"+sMonth+"-"+sDay;
//Here, you could modify the locale as you need !!!!
fHideCalendar();
}

function fHideCalendar()
{
VicPopCal.style.visibility = "hidden";
for (i in goSelectTag)
goSelectTag[i].style.visibility = "visible";
goSelectTag.length = 0;
}

function fSetSelected(aCell)
{
var iOffset = 0;
var iYear = parseInt(tbSelYear.value);
var iMonth = parseInt(tbSelMonth.value);

aCell.bgColor = gcBG;
with (aCell.children["cellText"])
{
var iDay = parseInt(innerText);
if (color==gcGray)
iOffset = (Victor<10)?-1:1;
iMonth += iOffset;
if (iMonth<1)
{
iYear--;
iMonth = 12;
}
else if (iMonth>12)
{
iYear++;
iMonth = 1;
}
}
fSetDate(iYear, iMonth, iDay, giHour,giMinute,giSecond);
}

function Point(iX, iY)
{
this.x = iX;
this.y = iY;
}

function fBuildCal(iYear, iMonth)
{
var aMonth=new Array();
for(i=1;i<7;i++)
{
aMonth[i]=new Array(i);
}

var dCalDate=new Date(iYear, iMonth-1, 1);
var iDayOfFirst=dCalDate.getDay();
var iDaysInMonth=new Date(iYear, iMonth, 0).getDate();
var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;
var iDate = 1;
var iNext = 1;

for (d = 0; d < 7; d++)
{
aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++;
}
for (w = 2; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);
}
}
return aMonth;
}

function fDrawCal(iYear, iMonth, iCellHeight, iDateTextSize)
{
var WeekDay = new Array("日","一","二","三","四","五","六");
var styleTD = " bgcolor='"+gcBG+"' bordercolor='"+gcBG+"' valign='middle' align='center' height='"+iCellHeight+"' style='font:bold "+iDateTextSize+" 宋体;";

with (document)
{
write("<tr>");
for(i=0; i<7; i++)
{
write("<td "+styleTD+"color:#990099' >" + WeekDay[i] + "</td>");
}
write("</tr>");

for (w = 1; w < 7; w++)
{
write("<tr>");
for (d = 0; d < 7; d++)
{
write("<td id=calCell "+styleTD+"cursor:hand;' onMouseOver='this.bgColor=gcToggle' onMouseOut='this.bgColor=gcBG' onclick='fSetSelected(this)'>");
write("<font id=cellText Victor='Liming Weng'> </font>");
write("</td>")
}
write("</tr>");
}
}
}

function fUpdateCal(iYear, iMonth)
{
myMonth = fBuildCal(iYear, iMonth);
var i = 0;
for (w = 0; w < 6; w++)
{
for (d = 0; d < 7; d++)
{
with (cellText[(7*w)+d])
{
Victor = i++;
if (myMonth[w+1][d]<0) {
color = gcGray;
innerText = -myMonth[w+1][d];
}else{
color = ((d==0)||(d==6))?"red":"black";
innerText = myMonth[w+1][d];
}
}

}
}
}

function fSetYearMon(iYear, iMon)
{
tbSelMonth.options[iMon-1].selected = true;
for (i = 0; i < tbSelYear.length; i++)
{
if (tbSelYear.options[i].value == iYear)
tbSelYear.options[i].selected = true;
}
fUpdateCal(iYear, iMon);
}

function fPrevMonth()
{
var iMon = tbSelMonth.value;
var iYear = tbSelYear.value;

if (--iMon<1)
{
iMon = 12;
iYear--;
}

fSetYearMon(iYear, iMon);
}

function fNextMonth()
{
var iMon = tbSelMonth.value;
var iYear = tbSelYear.value;

if (++iMon>12)
{
iMon = 1;
iYear++;
}

fSetYearMon(iYear, iMon);
}

function fToggleTags()
{
with (document.all.tags("Select"))
{
for (i=0; i<length; i++)
{
if ((item(i).Victor!="Won")&&fTagInBound(item(i)))
{
item(i).style.visibility = "hidden";
goSelectTag[goSelectTag.length] = item(i);
}
}
}
}

function fTagInBound(aTag)
{
with (VicPopCal.style)
{
var l = parseInt(left);
var t = parseInt(top);
var r = l+parseInt(width);
var b = t+parseInt(height);
var ptLT = fGetXY(aTag);
return !((ptLT.x>r)||(ptLT.x+aTag.offsetWidth<l)||(ptLT.y>b)||(ptLT.y+aTag.offsetHeight<t));
}
}

function fGetXY(aTag)
{
var oTmp = aTag;
var pt = new Point(0,0);
do
{
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent;
} while(oTmp.tagName!="BODY");
return pt;
}

var gMonths = new Array(" 一月"," 二月"," 三月"," 四月"," 五月"," 六月"," 七月"," 八月"," 九月"," 十月","十一月","十二月");

with (document)
{
write("<Div id='VicPopCal' onclick='event.cancelBubble=true' style='POSITION:absolute;visibility:hidden;border:2px ridge;width:10;z-index:100;'>");
write("<table border='0' bgcolor='#6699cc'>");
write("<TR>");
write("<td valign='middle' align='center'><input type='button' name='PrevMonth' value='<' style='height:20;width:20;FONT:bold' onClick='fPrevMonth()'>");
write(" <Select name='tbSelYear' onChange='fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won'>");
for(i=1900;i<2015;i++)
{
write("<OPTION value='"+i+"'>"+i+"年</OPTION>");
}
write("</Select>");
write(" <select name='tbSelMonth' onChange='fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won'>");
for (i=0; i<12; i++)
{
write("<option value='"+(i+1)+"'>"+gMonths[i]+"</option>");
}
write("</Select>");
write(" <input type='button' name='PrevMonth' value='>' style='height:20;width:20;FONT:bold' onclick='fNextMonth()'>");
write("</td>");
write("</TR><TR>");
write("<td align='center'>");
write("<DIV style='background-color:teal'><table width='100%' border='0' cellpadding='2'>");
fDrawCal(giYear, giMonth, 12, 12);
write("</table></DIV>");
write("</td>");
write("</TR><TR><TD align='center'>");
write("<B style='cursor:hand;font:bold 16 宋体' onclick='fSetDate(giYear,giMonth,giDay,giHour,giMinute,giSecond)' onMouseOver='this.style.color=gcToggle' onMouseOut='this.style.color=0'>今天:"+giYear+"年"+giMonth+"月"+giDay+"日</B>");
write("</TD></TR>");
write("</TABLE></Div>");

}
</SCRIPT>
<body>
<%

sdate=request("sdate")


%>
<h3><font color="red">请选择查询条件<b></font></h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="">
<tr>


<td width="80">按年份查询</td>
<td>
<!--input name="sdate" type="text" id="phone" width="100"-->
<input type="text" size="14" name="sdate" id="sdate" class="igray" onFocus="fPopCalendar(sdate,sdate); return false;" value="">

</td>&nbsp;

<td>
<input type="submit" name="Submit" value="提 交" class="tx">
</td>&nbsp;

</tr>
</form>
</table>
<%
if len(sdate)>0 then

%>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFCC99">

<tr align="center" bgcolor="#FFFFFF">
<td width="4%">ID</td>
<td width="12%">车型</td>
<td width="12%">年份</td>
<td width="12%">备注</td>
<td width="12%">车主</td>
<td width="12%">操作员</td>
</tr>
<%
sql="SELECT * FROM [carinfo] where sdate>'"&sdate&"'"



pagecount=0
pagesize=10
page=request("page")
if len(page)=0 then
page=1
else
page=cint(page)
end if

set rs=server.CreateObject("adodb.recordset")
rs.cursorlocation=3
rs.cursortype=3
rs.locktype=1
rs.open sql,conn1

rCount = rs.RecordCount
%>
<%

if not rs.eof then
pagecount=rs.pagecount
rs.movelast:rs.movefirst
recordcount=rs.recordcount
usedcount=0
while (not rs.eof)
incl="<font color=green>"
incr="</font>"
IF rs.absolutepage=page THEN
%>
<tr align="center" bgcolor="#FFFFFF">
<td><%=rs(0)&""%></td>
<td><%=rs(1)&""%></td>
<td><%=rs(2)&""%></td>
<td><%=rs(3)&""%></td>
<td><%=rs(4)&""%></td>
<td><%=rs(5)&""%></td>
</tr>
<%
END IF
rs.movenext
wend
rs.close()
%>
<tr align="right" bgcolor="#FF9999">
<td colspan="24"> <table width="717" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" align="center"><%=usedcount&"/"&recordcount%></td>
<td width="323">
<%
if page>1 then
response.write "| <A href=?page=1>首页</a> "
response.write "| <A href=?page="&(page-1)&">| 上一页</a> "
else
response.write "| 首页 "
response.write "| 上一页 "
end if

if pagecount>1 and page<pagecount then
response.write "| <A href=?page="&(page+1)&">下一页</a> "
response.write "| <A href=?page="&pagecount&">尾页</a> "
else
response.write "| 下一页 "
response.write "| 尾页 |"
end if

%>
</td>
<td width="132">
<%
if pagecount>1 then
%>
跳转到
<select name="select" onChange="window.location='?page='+(this.options.selectedIndex+1)">
<%
for i=1 to pagecount
response.write "<option value="&i
if i=page then response.write " selected"
response.write ">"&i&"</option>"
next
%>
</select>

<%
else
response.write "&nbsp;"
end if
%>
</td>
</tr>
</table></td>
</tr>
<%
else
%>
<tr align="center" bgcolor="#FFFFFF">
<td colspan="8">目前没有数据.</td>
</tr>
<%
end if
set rs=nothing
%>
</table>
<%
end if
%>
<body>
</body>
</html>
<%
conn1.close()
set conn1=nothing
%>

搜索更多相关主题的帖子: var head title style 
2006-04-19 17:03
sky_200828
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2005-7-5
收藏
得分:0 
<SCRIPT> 是日期控件 不用看的
看下面就可以的 谢谢!!!!!!!!!!
2006-04-19 22:56
sky_200828
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2005-7-5
收藏
得分:0 

楼上可以说的清楚点吗? 谢谢你了!!!!!

2006-04-20 09:23
sky_200828
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2005-7-5
收藏
得分:0 

先感谢大家的 帮助!!!!

我把 if len(sdate)>0 then 去掉后就可以正常翻页了,
但是这样 页面刚打开 还没有输入查询日期 就显示了

我的意图是只有选择日期 点击按扭后 才显示内容!!!

再次谢谢大家的 帮忙了 !!!!!!!!!!!!!!!!!!!!!!!!!

2006-04-21 08:42
快速回复:[求助]分页的问题为什么不显示第二页
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018471 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved