标题:刷新但是没有写入TXT文件
取消只看楼主
dukemian
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-7-17
结帖率:50%
已结贴  问题点数:20 回复次数:1 
刷新但是没有写入TXT文件
程序代码:
<%@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>



代码是这个,但是运行刷新的时候发现不管怎么点击图片,但是图片下面的累计没有增加,回到根目录去查询,发现没有写入文本,想来这里请教一下各位大大~~现在这里表示感谢啦~


这个是运行起来的照片,初学者求调教。。。
2012-07-17 11:25
dukemian
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-7-17
得分:0 
我已经解决了~但还是谢谢各位的帮助~
2012-07-21 23:30



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-373557-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.066422 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved