צפיות
תשובות
שאלה|בחלוקת עמודים
שלום רב,
יש לי קצת בעיה בהצגת עמודים קטנה.
נגיד ויש 100 עמודים
ואני רוצה להציג רק
8 כלומר:
1-2-3-4-5-6-7-8…100
וכן אלה
עם השלוש נקודות.
איך אני עושה זאת?
הנה הסקריפט שלי:
<%
CurrentPage = Request.querystring("pg")
if CurrentPage = "" Then CurrentPage = 1 end if
NumOfRecInPage =10
Rs.Open "SELECT * FROM tblarticles Order By Id Desc",Con,0,1
NumOfRec = Rs("id")
Rs.Close
strPageFrom = (NumOfRecInPage * CurrentPage) – NumOfRecInPage
strPageTo = NumOfRecInPage * CurrentPage
Rs.Open "select * from tblarticles LIMIT "&strPageFrom&","&strPageTo&";",Con,0,1
NumOfPages = Int((NumOfRec/NumOfRecInPage) + 0.9999)
For i = 1 to NumOfRecInPage
%>
data
<%
Rs.MoveNext
%>
<%
if rs.EOF Then i = NumOfRecInPage end if
Next
Rs.Close
Pages = ""
if CurrentPage > 1 Then
Pages = Pages & " <A Href=?pg=" & CurrentPage – 1 & "><img src='images/ne1.gif' border='0'/></A> "
End if
For i = 1 to NumOfPages
if i <> Cint(CurrentPage) Then
Pages = Pages & "<a href='Default.asp?pg="&i&"'><font color='#404040' face='arial' size='2'><b>"&i&"</b></font></a>"
else
Pages = Pages & "<font color='#404040' face='arial' size='2'>[</font><font color='#404040' face='arial' size='2'><b>"&i&"<b></font><font color='#404040' face='arial' size='2'>]</font>"
End if
Next
if Cint(CurrentPage) < Cint(NumOfPages) Then
Pages = Pages & " <A Href=?pg=" & CurrentPage + 1 & "><img src='images/be2.gif' border='0'/></A> "
End If
%>
תודה לעוזרים..

2 תשובות
נא ליישר קוד לשמאל
ולציין בדיוק מה לא מתפקד בקוד הנוכחי. אם אפשר להביא רק קטע רלוונטי – עדיף
אלי ענתבי
בבקשה:
<%
CurrentPage = Request.querystring("pg")
if CurrentPage = "" Then CurrentPage = 1 end if
NumOfRecInPage =10
Rs.Open "SELECT * FROM tblarticles Order By Id Desc",Con,0,1
NumOfRec = Rs("id")
Rs.Close
strPageFrom = (NumOfRecInPage * CurrentPage) – NumOfRecInPage
strPageTo = NumOfRecInPage * CurrentPage
Rs.Open "select * from tblarticles LIMIT "&strPageFrom&","&strPageTo&";",Con,0,1
NumOfPages = Int((NumOfRec/NumOfRecInPage) + 0.9999)
For i = 1 to NumOfRecInPage
%>
data
<%
Rs.MoveNext
%>
<%
if rs.EOF Then i = NumOfRecInPage end if
Next
Rs.Close
Pages = ""
if CurrentPage > 1 Then
Pages = Pages & " <A Href=?pg=" & CurrentPage – 1 & "><img src='images/ne1.gif' border='0'/></A> "
End if
For i = 1 to NumOfPages
if i <> Cint(CurrentPage) Then
Pages = Pages & "<a href='Default.asp?pg="&i&"'><font color='#404040' face='arial' size='2'><b>"&i&"</b></font></a>"
else
Pages = Pages & "<font color='#404040' face='arial' size='2'>[</font><font color='#404040' face='arial' size='2'><b>"&i&"<b></font><font color='#404040' face='arial' size='2'>]</font>"
End if
Next
if Cint(CurrentPage) < Cint(NumOfPages) Then
Pages = Pages & " <A Href=?pg=" & CurrentPage + 1 & "><img src='images/be2.gif' border='0'/></A> "
End If
%>
יישרתי..
הקוד עובד מצויין!
אבל אני רוצה
נגיד שיש 100 דפים
אז אני רוצה שזה יציג 8 ואם אני יכנס נגיד לדף רבעי זה יציג לי את דף 9-10-11-12
וכן אלה
תודה על העזרה.