?? tj_searchgo.asp
字號:
sub statheng(statname,tuwidth,tuwhich,thehow,unit,wherestr)
'statname 報告名稱
'tuwidth 橫圖每欄寬度
'thewhich 要查詢的項目
'thehow 共有多少種數據
'unit 項目的單位
'wherestr 查詢條件
'聲明輸出內容數組變量
dim val(),alt(),theper()
redim val(thehow),alt(thehow),theper(thehow)
'開始計算
sql="select " & thewhich & ",count(id) as theval from view " & wherestr & _
" group by " & thewhich & " order by " & thewhich
rs.Open sql,conn,1,1
themax=0
thesum=0
for i=0 to tuhow-1
if not rs.EOF then
alt(i)=rs(thewhich)
val(i)=rs("theval")
if cint(val(i))>themax then themax=cint(val(i))
thesum=thesum + cint(val(i))
rs.MoveNext
else
alt(i)=""
val(i)=0
end if
next
'防止除數為0而出錯
if themax=0 then themax=1
if thesum=0 then thesum=1
'計算百分數
for i=0 to tuhow-1
theper(i)=int(val(i)*1000/thesum)/10
if csng(theper(i))<1 then theper(i)="0" & theper(i)
next
'如果查詢項目是星期,則轉alt為漢字
if thewhich="vweek" then
for i=0 to tuhow-1
alt(i)=findweek(alt(i))
next
end if
rs.Close
'調用hengout子程序輸出到瀏覽器
hengout statname,tuwidth,themax,tuhow,val,alt,theper,unit
end sub
'================================
'
' 顯示分析圖表的子程序(橫)
'
'================================
sub hengout(statname,tuwidth,themax,tuhow,val,alt,theper,unit)
'statname 報告名稱
'tuwidth 橫圖每欄寬度
'themax x坐標最大值
'tuhow 柱圖有多少欄
'val() x坐標值數組
'alt() x坐標文字
'theper() 柱圖百分數
'unit x坐標單位
%>
<table width="500" cellspacing="0" align="center" cellpadding="0" border="0">
<tr><td colspan="3"><img src="images/photoup.gif"></td></tr>
<tr height="30">
<td width="1" class="backs"><img src="images/touming.gif" width="1" height="1"></td>
<td width="498"class="backq">
<img src="images/tb_title.gif" align=absmiddle> ∷∷∷ <%=statname%> ∷∷∷<br>
<table border="0" cellpadding="0" cellspacing="0" width="<%=tuhow * tuwidth + 70%>" align=center>
<tr height="9"><td></td></tr>
<tr height="101">
<td align=right valign=top>
<p style="line-height: 100%; margin-right: 2; margin-top: 0; margin-bottom: 13"><font face="Arial"><%=int(themax*10+0.5)/10%></font>
<p style="line-height: 100%; margin-right: 2; margin-top: 0; margin-bottom: 13"><font face="Arial"><%=int(3*themax*10/4+0.5)/10%></font>
<p style="line-height: 100%; margin-right: 2; margin-top: 0; margin-bottom: 13"><font face="Arial"><%=int(themax*10/2+0.5)/10%></font>
<p style="line-height: 100%; margin-right: 2; margin-top: 0; margin-bottom: 0"><font face="Arial"><%=int(themax*10/4+0.5)/10%><br></font></td>
<td width=10><img src="images/tu_back_left.gif"></td>
<%
for i= 0 to tuhow-1
%>
<td width="<%=tuwidth%>" valign=bottom background="images/tu_back.gif" align=center>
<img style="BORDER-BOTTOM: #000000 1px solid;" src="images/tu.gif"
height="<%=(val(i)/themax)*100%>" width="9"
alt="<%=alt(i)%><%=unit%>,訪問<%=val(i)%>次,<%=theper(i)%>%"></td>
<%
next
%>
<td width=10><img src="images/tu_back_right.gif"></td>
<td width=10></td>
</tr>
<tr height="18">
<td align=right>
<p style="line-height: 100%; margin-right: 2; margin-top: 0; margin-bottom: 0">
<font face="Arial">0</font></td>
<td width=10></td>
<%
for i= 0 to tuhow-1
%>
<td width="<%=tuwidth%>" align=center><a
title="<%=alt(i)%><%=unit%>,訪問<%=val(i)%>次,<%=theper(i)%>%"><font
face="Arial" style="letter-spacing: -1"><%=alt(i)%></font></a></td>
<%
next
%>
<td width=10></td>
<td width=10></td>
</tr>
<tr height="5"><td></td></tr>
</table>
</td>
<td width="1" class="backs"><img src="images/touming.gif" width="1" height="1"></td>
</tr>
<tr><td colspan="4"><img src="images/photodown.gif"></td></tr>
</table>
<br>
<%
end sub
%>
<%
'================================
'
' 輸出圖表數據的子程序(豎)
'
'================================
sub statshu(statname,leftwidth,thewhich,wherestr)
'statname 報告名稱
'leftwidth 橫圖每欄寬度
'thewhich 要查詢的項目
'wherestr 查詢條件
'聲明輸出內容數組變量
dim val(),alt(),theper(),alta()
on error resume next
'開始計算
sql="select " & thewhich & ",count(id) as theval from view " & wherestr & _
" group by " & thewhich & " order by count(id) DESC"
rs.Open sql,conn,1,1
themax=0
thesum=0
tuhow=rs.recordcount
if tuhow>100 then tuhow=100
redim val(tuhow),alt(tuhow),theper(tuhow),alta(tuhow)
i=0
do while not rs.EOF
alta(i)=rs(thewhich)
if (thewhich = "vcome") or (thewhich = "vpage") then
thelen=len(alta(i))
if thelen =0 then
alta(i)="#"
alt(i)="通過收藏或直接輸入網址訪問"
end if
if thelen <= 33 and thelen > 0 then
alt(i)=alta(i)
end if
if thelen >= 34 then
alt(i)=left(alta(i),31) & "..."
end if
else
alt(i)=alta(i)
end if
val(i)=rs("theval")
if cint(val(i))>themax then themax=cint(val(i))
thesum=thesum + cint(val(i))
if i=100 then exit do
i=i+1
rs.MoveNext
loop
'防止除數為0而出錯
if themax=0 then themax=1
if thesum=0 then thesum=1
'計算百分數
for i=0 to tuhow-1
theper(i)=int(val(i)*1000/thesum)/10
if csng(theper(i))<1 then theper(i)="0" & theper(i)
next
'如果查詢項目是星期,則轉alt為漢字
if thewhich="vweek" then
for i=0 to tuhow-1
alt(i)=findweek(alt(i))
next
end if
rs.Close
'調用hengout子程序輸出到瀏覽器
shuout statname,leftwidth,themax,tuhow,val,alt,alta,theper
end sub
'================================
'
' 顯示分析圖表的子程序(豎)
'
'================================
sub shuout(statname,leftwidth,themax,tuhow,val,alt,alta,theper)
'statname 報告名稱
'leftwidth 圖表左邊留給文字的寬度
'themax x坐標最大值
'tuhow 多少行記錄
'val() 記錄的值(訪問數)
'alt() 說明文字
'alta() 文字的連接
'theper() 柱圖百分數
%>
<table width="500" cellspacing="0" align="center" cellpadding="0" border="0">
<tr><td colspan="3"><img src="images/photoup.gif"></td></tr>
<tr height="30">
<td width="1" class="backs"><img src="images/touming.gif" width="1" height="1"></td>
<td width="498"class="backq">
<img src="images/tb_title.gif" align=absmiddle> ∷∷∷ <%=statname%> ∷∷∷<br>
<table border="0" cellpadding="0" cellspacing="0" width="<%=leftwidth+230%>" align=center>
<tr height="9"><td></td></tr>
<tr height="10">
<td width="<%=leftwidth%>"></td><td width="230"><img src="images/tu_back_up.gif"></td>
</tr>
<%for i=0 to tuhow-1%>
<tr>
<td width="220" align=right><a href="<%=alta(i)%>" target="_blank"
title="<%=alta(i) & vbcrlf%>訪問<%=val(i)%>次,<%=theper(i)%>%"><%=alt(i)%></a> </td>
<td width="230" background="images/tu_back_2.gif" align=left>
<img style="BORDER-left: #000000 1px solid;" src="images/tu.gif"
width="<%=(val(i)/themax)*183%>" height="9"
alt="<%=alta(i) & vbcrlf%>,訪問<%=val(i)%>次,<%=theper(i)%>%"> <%=val(i)%></td>
</tr>
<%
next
%>
<tr height="10">
<td width="220"></td><td width="230"><img src="images/tu_back_down.gif"></td>
</tr>
<tr height="5"><td></td></tr>
</table>
</td>
<td width="1" class="backs"><img src="images/touming.gif" width="1" height="1"></td>
</tr>
<tr><td colspan="4"><img src="images/photodown.gif"></td></tr>
</table>
<br>
<%
end sub
'================================
'
' 將星期轉為漢字的自定義函數
'
'================================
function findweek(theweek)
select case cstr(theweek)
case "1"
findweek="星期日"
case "2"
findweek="星期一"
case "3"
findweek="星期二"
case "4"
findweek="星期三"
case "5"
findweek="星期四"
case "6"
findweek="星期五"
case "7"
findweek="星期六"
end select
end function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -