文件管理 · 2022年7月25日

js网站计数器代码|网页中如何用代码设置网页访问计数器

㈠ 网站计数器代码

那我就用asp吧!代码如下:它是两个文件组成的,一个一定要是Global.asa,代码是:<script language="vbscript" runat="server">sub application_onstart()if isempty(application("counter")) thenapplication.lock()application("counter")=0application.unlock()end ifapplication.lock()application("counter")=application("counter")+1application.unlock()end sub</script>另一个文件index.asp的代码是:<html><body>你是第<%response.write application("counter")%>位访问者</body></html>这样应该ok了,要是你学过asp,应该会吧!

㈡ 如何在网页上加计数器,代码哪里要,要放在哪里

一。要完成此效果需要两个步骤第一步:把如下代码加入到<body>区域中<SCRIPTLANGUAGE="javaScript"><!–Beginvarms=0;varstate=0;functionstartstop(){if(state==0){state=1;then=newDate();then.setTime(then.getTime()-ms);}else{state=0;now=newDate();ms=now.getTime()-then.getTime();document.stpw.time.value=ms;}}functionswreset(){state=0;ms=0;document.stpw.time.value=ms;}functiondisplay(){setTimeout("display();",50);if(state==1){now=newDate();ms=now.getTime()-then.getTime();document.stpw.time.value=ms;}}//End–></SCRIPT><FORMNAME="stpw">本例的时间可以准确到百分之一秒<br>计时:<INPUTTYPE="text"Name="time"><br><INPUTTYPE="BUTTON"Name="ssbutton"VALUE="开始/停止"onClick="startstop()"><INPUTTYPE="BUTTON"NAME="reset"VALUE="重置"onClick="swreset()"></FORM>第二步:把“onLoad="display()"”加在<body>标记里例如:<bodyonLoad="display()">二。1.把以下代码存为一个名为imgcounter.asp的文件<%@language="VBScript"%><%dimimages(20)dimimageszeroCountFile=Server.MapPath("counter.txt")SetFileObject=Server.CreateObject("Scripting.FileSystemObject")SetOut=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE)counter=Out.ReadLineOut.CloseSETFileObject=Server.CreateObject("Scripting.FileSystemObject")SetOut=FileObject.CreateTextFile(CountFile,TRUE,FALSE)Application.lockifsession("counter")<>"pass"thencounter=counter+1session("counter")="pass"elsecounter=counter+0endifOut.WriteLine(counter)Application.unlockcountlen=len(counter)fori=1to8-countlenimageszero="<imgsrc="&"number/"&"/"&"0.gif></img>"response.write"document.write('"&imageszero&"');"nextfori=1tocountlenimages(i)="<imgsrc="&"number/"&"/"&mid(counter,i,1)&".gif></img>"response.write"document.write('"&images(i)&"');"nextOut.Close%>2.在与imgcounter.asp文件同根目录下建一个counter.txt的文件.在里头写入一个数字,刚开始应该是03.与2一样,创建一个文件number,在这个文件里头放十点GIF图片,图片上分别显示一到九.3.在需要显示计数器的地方插入以下代码:你是本站第<scriptlanguage="JavaScript"src="imgcounter.asp"></script>个访问者这样你的网站可以统计被访问过多少次,而且是以漂亮的图片显示出来.统计出来的数据是存放在文件中的,不会丢失.

㈢ 网站记数器的代码

你可以去网站上申请一个免费的网站计数器将代码插入到你的页面即可推荐几个比较不错的免费统计http://www.itsun.com/http://beta.1tong.com.cn/

㈣ 求一个网站计数器代码,要通用的HTML代码(分数不是问题,在线等)

去 http://www.51.la/ 申请一个,它会给你一个调用的代码,在回HTML中能够直接答调用!

㈤ 如何在网页上做计数器如何编写代码

计数器需要服务器端语言才能编写,要么将数字写入文件保存,要么将数字保存到数据库。如果使用Javascript编写客户端程序,那么要使用Cookie记住每个访问者浏览的次数,但是一旦访问者删除Cookie,那计数器就变回零了。这种方法不受你控制,也没有什么实际意义。所以依你现在的经验恐怕难以实现。建议你去找一下免费计数器Javascript代码,将代码嵌入你的网页当中,剩下的问题例如如何计数那就是提供者的问题了。http://count.knowsky.com/count2/你可以自己在网络搜索“免费计数器”或“免费流量统计”

㈥ 网站访问计数器代码

网站访问代码可在一些素材网站找,具体看你需要怎么展示的计数器代码

㈦ 网页中如何用代码设置网页访问计数器

1、将以下代码加在你需要得位置; 2、在根目录下创建名为count的文件夹,并在里面创建counter.txt文件,文件初始值为0(可更改); 3、将设置好的网页保存为.asp格式; 4、ok 您是第<span class="style2"> <% Const ForReading = 1, ForWriting = 2, ForAppending =3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 filepath=server.mappath("/count") filename=filepath+"\counter.txt" set fs=createobject("scripting.filesystemobject") if fs.fileexists(filename) then set f=fs.getfile(filename) Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault) s=ts.readline+1 ts.close else fs.createtextfile(filename) set f=fs.getfile(filename) s=1 end if '向counter.txt中写数据 Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault) ts.writeline(cstr(s)) ts.close '显示计数器 s=cstr(s+1000000) s=mid(s,2,8) for I=1 to 8 response.write mid(s,I,1) next %> </span>位访问者

㈧ 求一个网页计数代码 HTML

1.这个是写asp网页计数器的。Functions.asp文件代码<%Function Counts(CounterFile) Dim objFSO, objTS Application.Lock Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objTS = objFSO.OpenTextFile(Server.MapPath(CounterFile), 1, True) If Not objTS.AtEndOfStream Then '检查是否到达文件结尾 Counts = CLng(objTS.ReadLine) End If Counts = Counts + 1 objTS.Close Set objTS = objFSO.OpenTextFile(Server.MapPath(CounterFile), 2, True) objTS.WriteLine(Counts) objTS.Close Application.UnlockEnd Function%>显示统计效果<HTML> <BODY> <!– #include file="Functions.asp" –> <% If Session("Counter") = Empty Then Session("Counter") = Counts("Count.txt") End If %> <%= Session("Counter") %> </BODY></HTML>建一个Count.txt文件,里面写一个初始值,绝对可用的ASP网页计数器代码。 2.<script language=JavaScript>today=new Date();function initArray(){this.length=initArray.arguments.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }var d=new initArray(" 星期日"," 星期一"," 星期二"," 星期三"," 星期四"," 星期五"," 星期六");document.write("<font style='font-size:9pt;font-family: 宋体'> ",today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",d[today.getDay()+1],"</font>"); </script> 3.这是一段PHP代码,主控时间取自服务器时间(避免客户端时间的失准),但是原理是基于JS的,稍加改写即可用于不同平台. <? ####<读入系统时间功能>####function nowtime(){ $date=date("m/d/Y"); return $date;}?><?php $time = nowtime()?><script language="javascript">var urodz= new Date("10/18/2003"); //指定欲比较的日期var now = new Date("<?php echo $time ?>");//获得当前服务器日期var ile = urodz.getTime() – now.getTime() ;//做比较var dni = Math.floor(ile / (1000 * 60 * 60 * 24))+1;if (dni > 1)document.write("距日10/18/2003还有<font color=red size=20pt>"+dni+"</font>天")else if (dni == 1)document.write("只有2天啦!")else if (dni == 0)document.write("今天就是啊!")elsedocument.write("好象已经过了哦!");</script>

㈨ 网页被访问计数器代码

要自己写代码的。也可以到http://www.51.la/里面去申请