asp计数器的调用(100分)

  • 主题发起人 主题发起人 sakadeng
  • 开始时间 开始时间
S

sakadeng

Unregistered / Unconfirmed
GUEST, unregistred user!
我用dreamweaver做了个动画计数器,在地址栏直接输入地址是可以显示图片的,但在其它网页调用就不能显示,请问是什么原因呢?
其它网页:<script>和<img>都不能显示。用<iframe>可以显示,但其它网页不能用<iframe>调用,所以想知道是什么原因。
 
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connzd.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("PUsername") <> "") then

Recordset1__MMColParam = Request.QueryString("PUsername")
End If
%>
<%
if(Request.QueryString("PUsername") <> "") then
Command2__MMColParam = Request.QueryString("PUsername")
%>
<%
if(Request.QueryString("PUsername") <> "") then
Command1__MMColParam = Request.QueryString("PUsername")
if(Request.ServerVariables("REMOTE_ADDR") <> "") then
Command1__USR_IP = Request.ServerVariables("REMOTE_ADDR")
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_connzd_STRING
Recordset1_cmd.CommandText = "SELECT * FROM PUser WHERE PUsername = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 50, Recordset1__MMColParam) ' adVarChar
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
set Command2 = Server.CreateObject("ADODB.Command")
Command2.ActiveConnection = MM_connzd_STRING
Command2.CommandText = "UPDATE PUser SET Phit =Phit+1 WHERE PUsername = '" + Replace(Command2__MMColParam, "'", "''") + "' "
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()
%>
<%
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_connzd_STRING
Command1.CommandText = "INSERT INTO countip (PUsername, PIP) VALUES ('" + Replace(Command1__MMColParam, "'", "''") + "','" + Replace(Command1__USR_IP, "'", "''") + "') "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
<%
Dim Recordset3__MMColParam
Recordset3__MMColParam = "1"
If (Request.QueryString("PUsername") <> "") then

Recordset3__MMColParam = Request.QueryString("PUsername")
End If
%>
<%
Dim Recordset3
Dim Recordset3_numRows
Set Recordset3 = Server.CreateObject("ADODB.Recordset")
Recordset3.ActiveConnection = MM_connzd_STRING
Recordset3.Source = "SELECT * FROM countip WHERE PUsername = '" + Replace(Recordset3__MMColParam, "'", "''") + "' AND Ptime=date()-1"
Recordset3.CursorType = 0
Recordset3.CursorLocation = 2
Recordset3.LockType = 1
Recordset3.Open()
Recordset3_numRows = 0
%>
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("PUsername") <> "") then

Recordset2__MMColParam = Request.QueryString("PUsername")
End If
%>
<%
Dim Recordset2
Dim Recordset2_numRows
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_connzd_STRING
Recordset2.Source = "SELECT * FROM countip WHERE PUsername = '" + Replace(Recordset2__MMColParam, "'", "''") + "' AND Ptime=date()"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()
Recordset2_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset3_total
Dim Recordset3_first
Dim Recordset3_last
' set the record count
Recordset3_total = Recordset3.RecordCount
' set the number of rows displayed on this page
If (Recordset3_numRows < 0) then
Recordset3_numRows = Recordset3_total
else
if (Recordset3_numRows = 0) then
Recordset3_numRows = 1
End If
' set the first and last displayed record
Recordset3_first = 1
Recordset3_last = Recordset3_first + Recordset3_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset3_total <> -1) then
If (Recordset3_first > Recordset3_total) then
Recordset3_first = Recordset3_total
End If
If (Recordset3_last > Recordset3_total) then
Recordset3_last = Recordset3_total
End If
If (Recordset3_numRows > Recordset3_total) then
Recordset3_numRows = Recordset3_total
End If
End If
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset2_total
Dim Recordset2_first
Dim Recordset2_last
' set the record count
Recordset2_total = Recordset2.RecordCount
' set the number of rows displayed on this page
If (Recordset2_numRows < 0) then
Recordset2_numRows = Recordset2_total
else
if (Recordset2_numRows = 0) then
Recordset2_numRows = 1
End If
' set the first and last displayed record
Recordset2_first = 1
Recordset2_last = Recordset2_first + Recordset2_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset2_total <> -1) then
If (Recordset2_first > Recordset2_total) then
Recordset2_first = Recordset2_total
End If
If (Recordset2_last > Recordset2_total) then
Recordset2_last = Recordset2_total
End If
If (Recordset2_numRows > Recordset2_total) then
Recordset2_numRows = Recordset2_total
End If
End If
%>

<%
' *** Recordset Stats: if wedo
n't know the record count, manually count them
If (Recordset2_total = -1) then

' count the total records by iterating through the recordset
Recordset2_total=0
While (Not Recordset2.EOF)
Recordset2_total = Recordset2_total + 1
Recordset2.MoveNext
Wend
' reset the cursor to the begin
ning
If (Recordset2.CursorType > 0) then
Recordset2.MoveFirst
else
Recordset2.Requery
End If
' set the number of rows displayed on this page
If (Recordset2_numRows < 0 Or Recordset2_numRows > Recordset2_total) then
Recordset2_numRows = Recordset2_total
End If
' set the first and last displayed record
Recordset2_first = 1
Recordset2_last = Recordset2_first + Recordset2_numRows - 1

If (Recordset2_first > Recordset2_total) then
Recordset2_first = Recordset2_total
End If
If (Recordset2_last > Recordset2_total) then
Recordset2_last = Recordset2_total
End If
End If
%>
<%
' *** Recordset Stats: if wedo
n't know the record count, manually count them
If (Recordset3_total = -1) then

' count the total records by iterating through the recordset
Recordset3_total=0
While (Not Recordset3.EOF)
Recordset3_total = Recordset3_total + 1
Recordset3.MoveNext
Wend
' reset the cursor to the begin
ning
If (Recordset3.CursorType > 0) then
Recordset3.MoveFirst
else
Recordset3.Requery
End If
' set the number of rows displayed on this page
If (Recordset3_numRows < 0 Or Recordset3_numRows > Recordset3_total) then
Recordset3_numRows = Recordset3_total
End If
' set the first and last displayed record
Recordset3_first = 1
Recordset3_last = Recordset3_first + Recordset3_numRows - 1

If (Recordset3_first > Recordset3_total) then
Recordset3_first = Recordset3_total
End If
If (Recordset3_last > Recordset3_total) then
Recordset3_last = Recordset3_total
End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.style9 {font-size: 10px}
.style11 {color: #CC6600;
font-family: "迷你简娃娃篆";
font-size: 14px;
}
body,td,th {
font-family: 迷你简娃娃篆;
font-size: 14px;
color: #FF6600;
}
.abc {
font-family: "迷你简娃娃篆";
font-size: 14px;
color: #FF3300;
text-decoration: blink;
border-top-color: #FF6600;
border-right-color: #FF6600;
border-bottom-color: #FF6600;
border-left-color: #FF6600;
}
-->
</style>
</head>
<body>
<% If Not Recordset1.EOF Or Not Recordset1.BOF then
%>
<table width="150" height="170" border="0" cellspacing="0">
<tr>
<td>
<td align="right" valign="bottom" background="images/<%=(Recordset1.Fields.Item("PStyle").Value)%>" ><br>
今天浏览<br>
<%=(Recordset2_total)%><br>
昨天浏览<br>
<%=(Recordset3_total)%><br>
总浏览<br>
<%=(Recordset1.Fields.Item("Phit").Value)%></td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset3.Close()
Set Recordset3 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
 
这是我的代码,请帮我看看,谢谢!
 
还是自己,请高手帮帮我,看哪里出错了,需要修改哪里,其它网页才可以用<script>和<img>调用计数器呢?
 
怎么说你呢?
计数器都不会,您还会什么?
<img src='http://localhost/count.asp'/>
方法1
实际count.asp ,只需要返回某个图片的url(需要临时生成)
方法2
http://localhost/count.asp
直接输出 n 个小图 ,每个图一个数字.
用什么script啊,自己降低速度.
减少client的script,可以提高速度
 
请问在什么地方加图片的url
 
bsense:
我上面的代码就是counter.asp的,在要放计数器的网页的位置写上:<img src='http://www.xxx.com/count.asp?PUsername=123'>,上传后网页计数器的位置显示为x,请问,counter.asp的网页需要修改什么才可以在要放计数器的网页正常显示计数器呢?
 
正确 counter.asp 里面输出 一个图片就行了
 
bsense:
<td align="right" valign="bottom" background="images/<%=(Recordset1.Fields.Item("PStyle").Value)%>" ><br>
这里就是输出图片,请帮我改改好吗?谢谢
 
顺便发个交流群:delphi天堂群:4654765,不去是你的损失 ,长期不发言者勿入
 
我做过一个网页计数器,
QQ 87797301
 
后退
顶部