CSDN博客

img sup_haiker

计数器(数据库存储)

发表于2004/10/16 18:06:00  604人阅读

<%

//Program Name:Counter
//Author:magicfox
//Time:10/14/2004

 

function setCount()
{
    var sql,DataSet;
    var DataSet;
    var err=new Error();
 var result;

    DataSet=Server.CreateObject("Adodb.recordset");
    sql="select count from counter";
    DataSet.Open(sql,DataConn,1,1);
 if (err.number!=0)
 {
  
 }
 else
 {
  result=DataSet("count").value; 
  DataSet.close;
        sql="update counter set count=count+1";
     DataConn.Execute(sql);
 }
 return(result);
}


function showCount(Num)
{

 var j,i,Num;
 var tmp=new String();

 tmp=Num.toString();
 j=tmp.length;
 i=1;
    Response.Write("您是本站第<span class='wordr'><b>");
 while (i<=(8-j))
 {
     Response.Write("0");
  i=i+1;
 }

    Response.Write(Num+"</b></span>位来访问者");
}


function Counter()
{
 this.count=0;
 this.setCount=setCount;
 this.showCount=showCount;
}
%>

0 0

相关博文

我的热门文章

img
取 消
img