| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 421 人关注过本帖
标题:刷新但是没有写入TXT文件
只看楼主 加入收藏
dukemian
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-7-17
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:3 
刷新但是没有写入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
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:10 
没有写入估计是权限的问题
2012-07-17 14:47
netlin
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:24
帖 子:544
专家分:4308
注 册:2012-4-9
收藏
得分:10 
检查一下,你的TXT文件所在文件夹的目录权限和这个个文件的权限,
最好把它们的权限都设为Everyone有"完全控制"权。


做自己喜欢的事!
2012-07-19 09:16
dukemian
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-7-17
收藏
得分:0 
我已经解决了~但还是谢谢各位的帮助~
2012-07-21 23:30
快速回复:刷新但是没有写入TXT文件
数据加载中...
 
   



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

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