⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tj_searchgo.asp

📁 一个关于房产的asp程序
💻 ASP
📖 第 1 页 / 共 2 页
字号:
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">
    
		&nbsp; <img src="images/tb_title.gif" align=absmiddle> &nbsp;∷∷∷ <%=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">
    
		&nbsp; <img src="images/tb_title.gif" align=absmiddle> &nbsp;∷∷∷ <%=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>&nbsp;</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 + -