DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: lixuan123
今日帖子: 0
在线用户: 5
导航: 论坛 -> 网站意见 斑竹:zizii,sunyesy  
作者:
男 flashbear (flashbear) ★☆☆☆☆ -
普通会员
2003/9/3 18:53:23
标题:
asp调用asp文件的问题 浏览:2842
加入我的收藏
楼主: counter.asp  
*************************  
<%  
path="d:data"  
file=request("save")  

url=request("url")  
Set fs = CreateObject("Scripting.FileSystemObject")  
if fs.FileExists(path & file & ".txt") then  
Set thisfile = fs.OpenTextFile(path & file & ".txt", 1, False)  
number=thisfile.readline + 1  
thisfile.Close  
Set outfile=fs.CreateTextFile(path & file & ".txt")  
outfile.WriteLine number  
outfile.close  
set fs=nothing  
else  
number=1  
Set outfile=fs.CreateTextFile(path & file & ".txt")  
outfile.WriteLine number  
outfile.close  
set fs=nothing  
end if  

response.redirect url  

%>  



view.asp  
***************************  
<%  
path="d:data"  
file=request("save")  
Set fs = CreateObject("Scripting.FileSystemObject")  
if fs.FileExists(path & file & ".txt") then  
Set thisfile = fs.OpenTextFile(path & file & ".txt", 1, False)  
number=thisfile.readline  
thisfile.Close  
set fs=nothing  
else  
number=0  

end if  
response.contenttype = "application/x-javascript"  
response.write "document.write(""" & number & """);"  

%> 
我在index.asp里用
<a href=counter.asp?save=123&url=http://www.hudaxiang.com/>http://127.0.0.1</a>
共点击了:<script src=view.asp?save=123></script>次
调用,但为什么调用不出来?
但和上次那个一样,文本文件里的数字会相应的加1,
但就是显示不出来
请问这样调对吗?谢谢~
----------------------------------------------
-
作者:
男 zizii (高高高级馒头) ★☆☆☆☆ -
神秘会员
2003/9/3 19:37:38
1楼: 能加1就说明asp可以运行,你在index.asp中写入
<a href=counter.asp?save=123&url=http://www.hudaxiang.com/>http://127.0.0.1<;/a>
共点击了:<% =view.asp?save=123 %>次
试试看,或者就直接用<!--#include file="view.asp?save=123" -->
----------------------------------------------
维护世界和平,共创美好盒子。
作者:
男 flashbear (flashbear) ★☆☆☆☆ -
普通会员
2003/9/3 20:11:12
2楼: index.asp里的搞定了,
不过还是用
<a href=counter.asp?save=123&url=http://www.hudaxiang.com/>http://127.0.0.1</a> 
共点击了: <font color="#FF0000"><script src=view.asp?save=123></script></font>
搞定的,但用这个连接出来的子网页在状态栏下有语法错误~
不知道怎么回事,
呵,谢谢楼上的版主~~
counter.asp的代码是
<%  
path=server.MapPath("my_") 
file=request("save")  

url=request("url")  
Set fs = CreateObject("Scripting.FileSystemObject")  
if fs.FileExists(path & file & ".txt") then  
Set thisfile = fs.OpenTextFile(path & file & ".txt", 1, False)  
number=thisfile.readline + 1  
thisfile.Close  
Set outfile=fs.CreateTextFile(path & file & ".txt")  
outfile.WriteLine number  
outfile.close  
set fs=nothing  
else  
number=1  
Set outfile=fs.CreateTextFile(path & file & ".txt")  
outfile.WriteLine number  
outfile.close  
set fs=nothing  
end if  

response.redirect url  

%>
view.asp里的代码是
<%   
path=server.MapPath("my_") 
file=request("save")  
Set fs = CreateObject("Scripting.FileSystemObject")  
if fs.FileExists(path & file & ".txt") then  
Set thisfile = fs.OpenTextFile(path & file & ".txt", 1, False)  
number=thisfile.readline  
thisfile.Close  
set fs=nothing  
else  
number=0  

end if  
response.contenttype = "application/x-javascript"  
response.write "document.write(""" & number & """);" 
 %>
还有就是有人说里面的application.lock没有用??~~
不知道他说的对不对???~~~~
我想应该有用吧,这是和计数器的原理一样的,如果有两个人同时点了链接,而没用application.lock的话那么计数器就只会计一次,是这样的吧,所以应该还是有用的
----------------------------------------------
-
作者:
男 flashbear (flashbear) ★☆☆☆☆ -
普通会员
2003/9/4 9:36:06
3楼: 啊,我终于找到原因了~
因为我当时建的asp文件是用dw4里的新建,动态网页,vbscript~~~
而出来的头部分是~~
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
这一些
而我把这些都删了,把body和html也删了,然后就可以了~~
请问版主这是为什么???
谢谢
----------------------------------------------
-
作者:
男 zizii (高高高级馒头) ★☆☆☆☆ -
神秘会员
2003/9/4 12:59:11
4楼: 啊,这样呀,<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>这个申明我也用了,没有问题,反正网页代码就一个字,烂,我同样的代码不同时候运行结果还不样。
----------------------------------------------
维护世界和平,共创美好盒子。
作者:
男 flashbear (flashbear) ★☆☆☆☆ -
普通会员
2003/9/5 17:20:38
5楼: 哈哈哈哈,那看来要给microsoft提意见了,哈哈~~
----------------------------------------------
-
作者:
男 waya (waya.blue) ★☆☆☆☆ -
普通会员
2003/9/17 16:01:09
6楼: 第一次来,无语……
----------------------------------------------
-
作者:
男 maxid (思源) ★☆☆☆☆ -
普通会员
2003/9/23 22:59:29
7楼: 这个zizii哈哈..哈哈
----------------------------------------------
一面之缘
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行60.54688毫秒 RSS