Another use of the counter: automatically switch home picture

Source: Internet
Author: User
Tags count
Every time a counter visitor comes in and sees the same picture, does it appear a bit of mono-apoptotic?


let visitors see a different picture every time they come? With the counter is very simple to achieve!


source program is as follows:





<%


'----------------------------------------------------------counting program started


Dim fileobject,countfile,out,counter,picno,pp


Set fileobject=server.createobject ("Scripting.FileSystemObject")


Countfile=server.mappath ("Count.txt")


Set out=fileobject.opentextfile (countfile,1,false,false)


Counter=out.readline


Out.close


SET fileobject=server.createobject ("Scripting.FileSystemObject")


Set out=fileobject.createtextfile (countfile,true,false)


Application.Lock


counter= counter + 1


'----------------------------------------------------------Counting program end





if counter>99 then counter=0 ' cannot exceed a value, this place


you notice, you can't be the same as the numeric variables displayed: (


If Counter<10 then ' I now only have 10 pictures, 10 below is


' show how much


Picno=counter


Else


picno= (counter mod 10) ' is larger than 10, because I have only 10


Picture: (


End If


out.writeline (counter) ' The current count value exists counter.txt inside


Application.UnLock


Out.close


%>




The method used to
This example is to use a text file for access





Display Picture





<%response.write ("<img src=http://www.163design.net/a/y/" & Images/face/face "&picno&". jpg width=229 height=160> ")%>











Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.