我就是不会写了,我知道要先读出来,然后再写进去,
那具体该怎么写呢,
真的很感激呀!
谁写出来了分数我都给他了!跪下了,因为实在写了好几天都不行呀
<%
var path = Server.MapPath("test.txt");
var MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
var MyTextFile = MyFileObject.CreateTextFile(path)
MyTextFile.WriteLine("") MyTextFile.Close();
%>
那具体该怎么写呢,
真的很感激呀!
谁写出来了分数我都给他了!跪下了,因为实在写了好几天都不行呀
<%
var path = Server.MapPath("test.txt");
var MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
var MyTextFile = MyFileObject.CreateTextFile(path)
MyTextFile.WriteLine("") MyTextFile.Close();
%>
解决方案 »
- 如何将js的值传到字体大小的设置中
- window.showModalDialog 的子页面中DTree树不能用
- ** 关于 jquery 的一个小问题!
- responseText中提取td元素的正则表达式再次开贴问题还没搞定
- 关于弹出式提式框
- 变量传递???????????????????
- 请给邮一份梅花雪的树控件完整版1.0和2.0版(包括rar,css,使用到的图片,使用文档,demo)
- javascript ;如何检测文件两个图片文件是否存在,选择显示在的图片?
- 关于窗口关闭的新问题,以及隐去IE的菜单栏、地址栏、状态栏的问题
- netscape7.0下的children?
- 来看看这个最简单的问题吧
- 如何弹出一个别不轨则窗体?
<%
Application.Lock()
Application("Counter") = parseInt(Application("Counter")) + 1
Application.UnLock()
%> <%
var path = Server.MapPath("test.txt");
var MyFileObject = Server.CreateObject("Scripting.FileSystemObject");
var MyTextFile = MyFileObject.CreateTextFile(path);
MyTextFile.Write(Application("Counter"))
MyTextFile.WriteLine("");
MyTextFile.Close();
%>
MyTextFile.readAll();
<%
var path = Server.MapPath("test.txt");
var MyFileObject = Server.CreateObject("Scripting.FileSystemObject");
var MyTextFile = MyFileObject.CreateTextFile(path);
MyTextFile.Read(1)
%> <%
Application("Counter")=MyTextFile.Read(1)
Application.Lock()
Application("Counter") = parseInt(Application("Counter")) + 1 Application.UnLock()
Response.Write(Application("Counter"))
%>
<%
var path = Server.MapPath("test.txt");
var MyFileObject = Server.CreateObject("Scripting.FileSystemObject");
var MyTextFile = MyFileObject.CreateTextFile(path);
MyTextFile.Write(Application("Counter"))
MyTextFile.WriteLine("");
MyTextFile.Close();
%>问题在那里呢?
dim visitors
whichfile=server.mappath("counter.txt")set fs=createobject("Scripting.FileSystemObject")
set thisfile=fs.opentextfile(whichfile)
visitors=thisfile.readline
thisfile.closeCountLen=len(visitors)
response.write "<center>欢迎您!您是第"
for i=1 to 6-countLen
response.write "<img src=0.gif></img>"
next for i=1 to countlen
response.write "<img src=" & mid(visitors,i,1) & ".gif></img>"
next
response.write "位客人</center>"
visitors=visitors+1set out=fs.createtextfile(whichfile)
out.writeLine(visitors)
out.close
set fs=nothing
%>
<script language = "vbscript" runat = "server">
sub application_onstart
'取的计数文件的真实路径
countfile=server.mappath("count.txt")
'创建文件系统对象实例
set myfso = server.createobject("scripting.filesystemobject")
'若计数文件不存在
if not myfso.fileexists(countfile) then
'创建该文件及取得textstream对象实例
set mytextstream = myfso.createtextfile(countfile, True)
application.lock
application("online") = 0
application("counter") = 0
application.unlock
'将计数值写入文件
mytextstream.writeline(cstr(application("counter")))
else
'以只读的方式打开
set mytextstream = myfso.opentextfile(countfile,1,false)
'读一行,并将值赋给计数变量
application("counter") = mytextstream.readline
end if mytextstream.close
set myfso = nothing
end subsub session_onstart
session.timeout = 1
countfile = server.mappath("count.txt")
set myfso = server.createobject("scripting.filesystemobject")
application.lock
application("online") = application("online")+1
application("counter") = application("counter")+1
application.unlock
'以写方式打开文件
set mytextstream = myfso.opentextfile(countfile,2,false)
'以写行的方式将数据写入文件
mytextstream.writeline(cstr(application("counter")))
mytextstream.close
set myfso = nothing
end subsub session_onend
application.lock
application("online") = application("online")-1
application.unlock
end sub
</script> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计数器例子</title>
</head>
<body>
<div align="center">您是本站第<font color="#FF0000"><%=application("counter")%></font>位贵宾!
</div>
</body>
</html>