<table width="100%" border="0" cellspacing="2" cellpadding="0" class="myfont" style="border:#CCCCCC dotted 1px">
<form name="form1" method="post" action="">
<tr>
<td align="center">ตั้งแต่วันที่
<input name="startdate" type="text" id="startdate" size="10" value="<%=isdateNtime(startdate)%>" readonly style="background-color:#CCCCCC">
<INPUT name="button" type=button class="d1" onClick="gfPop.fStartPop(this.form.startdate,this.form.enddate);" >ถึง
<input name="enddate" type="text" id="enddate" size="10" value="<%=isdateNtime(enddate)%>" readonly style="background-color:#CCCCCC">
<INPUT name="button" type=button class="d1" onClick="gfPop.fEndPop(this.form.startdate,this.form.enddate);" >
<!--- ส่วนการเลือก listmenu เพื่อค้นหา --->
<select name="subp" id="subp" >
<%
set Rs= Server.CreateObject("ADODB.Recordset")
sql1 = "Select * From site_Organize1 order by code"
Rs.Open sql1, MM_data_STRING ,1 ,1
if not rs.eof then
while not rs.eof
%>
<option value="<%=rs("name")%>" <%if subp=rs("name") then response.Write("selected") end if%>><%=rs("name")%></option>
<%
rs.movenext
wend
end if
rs.close()
set rs=nothing
%>
</select>
<input type="submit" name="Submit" id="Submit" value="Submit"></td>
</tr>
</form>
</table>
<table width="100%" border="0" align="left" cellpadding="6" cellspacing="1" class="myfont">
<tr bgcolor="#0066CC" class="clsCMVOn">
<td align="center">ลำดับ</td>
<td width="729" height="25"><div align="center">ชื่อเนื้อหา</div></td>
<td width="136" align="center">จำนวนผู้เข้าชม</td>
</tr>
<%
PageSize=20
if Request.QueryString("PageNo")="" then
PageNo=1
else
PageNo=cint(Request.QueryString("PageNo"))
end if
if isdate(startdate) and isdate(enddate) then
sqll=" where dirname <>'' and logdate between '"&startdate&" 00:00:01' and '"&enddate&" 23:59:59' "
else
sqll=" where dirname <>'' and logdate between '"&startdate&" 00:00:01' and '"&enddate&" 23:59:59' "
end if
if request("subp")<>"" then
sqllp=" and pagename='"&request("subp")&"' "
else
sqllp=" and pagename='"&subp_de&"' "
end if
Set rs = Server.CreateObject("ADODB.Recordset")
sql1="select name,count(id) as aa from content_Log "&sqll&" "&sqllp&" group by name order by aa desc"
redim color(2) : color(0)="#FFFFFF" : color(1)="#F0FFFF"
rs.Open sql1, MM_data_STRING,1 ,1
if not rs.eof then
Rs.PageSize=PageSize
PageCount=cint(Rs.PageCount)
Rs.AbsolutePage=PageNo
end if
nID=1 :while not Rs.eof and nID<=PageSize
qrey="&startdate="&startdate&"&enddate="&enddate&"&subp="&request("subp")
%>
<tr bgcolor="<%=color(c)%>" onMouseOver="this.style.background='#FFFF99';" onMouseOut="this.style.background='<%=color(c)%>'" >
<td width="72" align="center"><%=(pagesize*(pageno-1))+nID%></td>
<td><b><%=rs("name")%></b></td>
<td align="center"><%=rs("aa")%></td>
</tr>
<% nID=nID+1
if c=1 then c=0 else c=1 end if
rs.movenext
wend
if rs.recordcount >0 then
rs.movefirst
end if%>
<tr align="right" class="myfont">
<td colspan="7">ทั้งหมด <b><%=Rs.recordcount%></b> รายการ
<%
Response.Write(" [")
If PageNo > 1 Then 'สร้างลิ๊งก์ <<Frist , <Prev
Response.Write vbCrLf &"<a href=report_content.asp?PageNo=1"&qrey&"><<</a>"
Response.Write vbCrLf &"<a href=report_content.asp?PageNo="&PageNo-1&qrey&"><</a>"
End If
LRPages = 4
TotalPageCount = PageCount
if PageCount > 10 then
PageCount = 10
if PageNo > PageCount then 'ในกรณีที่ current page มากกว่าเพจที่ 10
if request("Rscommentall") = "" then
intForLoopToRscommentAllPages = PageNo - LRPages
if TotalPageCount - PageNo <= LRPages then
PageCount = TotalPageCount - PageNo
PageCount = PageNo + PageCount
else
PageCount = PageNo + LRPages
end if
else
intForLoopToRscommentAllPages = PageNo - LRPages
PageCount = TotalPageCount
end if
else
if request("Rscommentall") = "" then
intForLoopToRscommentAllPages = 1
else
intForLoopToRscommentAllPages = PageNo
PageCount = TotalPageCount
end if
end if
else
intForLoopToRscommentAllPages = 1
end if
If PageNo > 1 or NOT Rs.EOF Then
for intLinkPageNum = intForLoopToRscommentAllPages to PageCount
If intLinkPageNum = PageNo Then
Response.Write vbCrLf&"<b>"&intLinkPageNum&"</b>"
else
Response.Write vbCrLf & " <a href=report_content.asp?PageNo="&intLinkPageNum&qrey&">" & intLinkPageNum & "</a>"
end If
next
end If
If NOT rs.EOF and PageNo<>TotalPageCount and request.QueryString("Rscommentall")<>"yes" then 'สร้างลิ๊งก์ Next> ,Last>>
Response.Write vbCrLf & " <a href=report_content.asp?PageNo="&PageNo+1&qrey&">></a>"
Response.Write vbCrLf & " <a href=report_content.asp?PageNo="&TotalPageCount &qrey&">>></a>"
end If
if TotalPageCount > 10 and request.QueryString("Rscommentall")<>"yes"then
Response.Write vbCrLf & " <a href=report_content.asp?PageNo=1&Rscommentall=yes"&qrey&">...</a>"
end If
Response.Write(" ]")
rs.close() %></td>
</tr>
</table>
<script language="JavaScript" type="text/JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
Code (ASP)
<select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('self',this,0)">
<option value="in_reportcontent.asp?pagename=""">ทั้งหมด</option>
<%set Rs= Server.CreateObject("ADODB.Recordset")
sql1 = "Select * From site_Organize1 order by code"
Rs.Open sql1, MM_data_STRING ,1 ,1
if not rs.eof then
while not rs.eof
%>
<option value="in_reportcontent.asp?pagename=<%=rs("name")%>" <%if num(request("name"))=rs("name") then response.Write("selected") end if%>><%=rs("name")%></option>
<%
rs.movenext
wend
end if
rs.close()
set rs=nothing
%>
</select>