يه كنتر با ظاهر گرافيكي ميخوام

cactus13

Member
يه كنتر ميخوام كه ترجيحا با asp باشه و شكل و شمايل قشنگي داشته باشه.
 

Sir_iranian

New Member
کد:
<%
fp = Server.MapPath("aspcount.txt")
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(fp)
ct = Clng(a.ReadLine)
if Session("ct") = "" then
Session("ct") = ct
ct = ct + 1
a.close
Set a = fs.CreateTextFile(fp, True)
a.WriteLine(ct)
end if 
a.Close
Response.Write ct
%>

Note that the first thing I did was to open the file for reading, and read the value in it, converting it to an integer. The second block of code checks to see whether the user is coming back to the page during the same session. It checks for a Session variable called "ct." If the variable isn't present, it creates it. Then it increments the value from the text file, closes it, opens it for writing, and writes the new value to it. The final block of code closes the file and writes the value to the page.

The second example uses the value in a Javascript function to create an "image-based" display.

var str = "<%=ct%>";
var begin = "<img src=\"images/dg";
var middle = ".gif\" width=\"16\" height=\"21\" alt=\"";
var last = "\">";
for(x = 0;x < str.length; x++)    {
    str1 = str.charAt(x);
    document.write(begin + str1 + middle + str1 + last);
    }

There are 10 images in the images folder, called "dg0.gif" through "dg9.gif." Each image is a digit with the same value as its' identifier number in the file name. This function creates a string from the variable created in the ASP script above it (see the ASP tag inside the quotes?). It then creates several string variables which are used to construct the image tag. It loops through the string, one letter at a time, and displays the string in image form on the page.
من حال نداشتم ترجمش كنم اگه نتونستي بخوني به بروبچ بگو بران ترجمه كنن ;)
 

spsgorgan

Active Member
سلام
اول اينكه ميشه اين كدو در فرونت ژيچ استفاده كرد ؟
و دوم اينكه اگر ميشه استفاده كرد چطوري بزاريم تو html صفحه ؟

ممنون
 

جدیدترین ارسال ها

بالا