![]() |
#2
aspic2012-07-17 14:47
|

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
function readvote(counterfile)
dim jia,mian
set jia = server.CreateObject("scripting.filesystemobject")
set mian = jia.opentextfile(server.MapPath(counterfile),1,true)
if not mian.atendofstream then
readvote = clng(mian.readline)
else
readvote = 1
end if
mian.close
end function
sub writevote(counterfile,counter)
dim jia,mian
jia = server.CreateObject("scripting.filesystemobject")
mian = jia.opentextfile(server.MapPath(counterfile),2,true)
mian.write(counter)
mian.close
end sub
dim vote,counter1,counter2,counter3
application.Lock
counter1 = readvote("star1.txt")
counter2 = readvote("star2.txt")
counter3 = readvote("star3.txt")
if vote = "star1" then
counter1 = counter1 + 1
writevote "star1.txt" &counter1
elseif vote = "star2" then
counter2 = counter2 + 1
writevote "star2.txt"&counter2
elseif vote = "star3" then
counter3 = counter3 + 1
writevote "star3.txt"&counter3
end if
application.UnLock
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>计算票数</title>
</head>
<body>
<P><img src="star0.jpg" /></P>
<table>
<tr>
<td><a href="vote.asp"?vote="star1"><img src="star1.jpg" width="240" height="320" /></a></td>
<td><a href="vote.asp"?vote="star2"><img src="star2.jpg" width="240" height="320" /></a></td>
<td><a href="vote.asp"?vote="star3"><img src="star3.jpg" width="240" height="320" /></a></td>
</tr>
<tr>
<td>蔡依林的票数为:<%=counter1%></td>
<td>杰西卡的票数为:<%=counter2%></td>
<td>斯嘉丽的票数为:<%=counter3%></td>
</tr>
</table>
</body>
</html>
代码是这个,但是运行刷新的时候发现不管怎么点击图片,但是图片下面的累计没有增加,回到根目录去查询,发现没有写入文本,想来这里请教一下各位大大~~

只有本站会员才能查看附件,请 登录
这个是运行起来的照片,初学者求调教。。。