ASP静态页面点击率问题 asp
在网上找了很多关于ASP静态页面点击率的解决办法,但是都没有效果,后来仔细研究,终于明白了到底问题出在哪里...
==========================================================
在生成的静态页面点击率的位置添加...
在网上找了很多关于ASP静态页面点击率的解决办法,但是都没有效果,后来仔细研究,终于明白了到底问题出在哪里...
==========================================================
在生成的静态页面点击率的位置添加如下代码:
<script language="javascript" src="1.asp?id=1"></script>
==========================================================
在1.asp中写入如下代码:
<!-- #include file="conn.asp" -->
id=request("id")
sql="update news set hits=hits+1 where id="&id
conn.execute(sql)
sql="select hits from news where id="&id
rs.open sql,conn,1,1
If rs.eof Then
Else
response.write "document.write("&rs("hits")&")"
End If
rs.close
Set rs=nothing
%>
==========================================================
注:在最后输出的时候要写成:
response.write "document.write("&rs("hits")&")"
如果不写 "document.write",静态页面中是不会显示点击数的
==========================================================
在生成的静态页面点击率的位置添加如下代码:
<script language="javascript" src="1.asp?id=1"></script>
==========================================================
在1.asp中写入如下代码:
<!-- #include file="conn.asp" -->
id=request("id")
sql="update news set hits=hits+1 where id="&id
conn.execute(sql)
sql="select hits from news where id="&id
rs.open sql,conn,1,1
If rs.eof Then
Else
response.write "document.write("&rs("hits")&")"
End If
rs.close
Set rs=nothing
%>
==========================================================
注:在最后输出的时候要写成:
response.write "document.write("&rs("hits")&")"
如果不写 "document.write",静态页面中是不会显示点击数的
下一篇:asp伪装成jsp的方法
最新评论
热门推荐
我要评论