日期:2014-05-17  浏览次数:20944 次

如何让一个asp页面执行,但不显示
如果写到一页里面,每页都需要添加FsoDel.asp的代码,有没有方式让FsoDel.asp执行但不显示   谢谢


xxx.asp

<a   href= "FsoDel.asp?FilePath= <%=Rs( "PhotoPath ")%> "   onClick= "return   confirm( '您确定要删除吗? '); "   target= "hiddenasp "> 删除图片 </a>

FsoDel.asp

<%
filepath=Trim(Request( "FilePath "))  
if   filepath= " "   then  
Response.Write   " <script> alert( " "该图片不存在! " ");location.href= " "javascript:window.close(); " "; </script> "
Response.End  
end   if  

Set   deleteFileObject=Server.CreateObject( "Scripting.FileSystemObject ")  
delefilepath=Server.MapPath(filepath)  

if   deleteFileObject.FileExists(delefilepath)   then  
Set   delefilepath=deleteFileObject.GetFile(delefilepath)  
delefilepath.Delete  
Response.Write   " <script> alert( " "图片删除成功! " ");location.href= " "javascript:window.close(); " "; </script> "
else  
Response.Write   " <script> alert( " "该图片不存在! " ");location.href= " "javascript:window.close(); " "; </script> "
end   if
%>

------解决方案--------------------
弹出新窗口,高宽为0,然后self.close
------解决方案--------------------
给你个建议:
新浪爱问里,每个问题页都有个举报,它会弹出一个窗口
你把它的页面当下来,还有js
在你的xxx.asp里弹出FsoDel.asp,通过XXX.ASP里定义弹出的长宽,标题定为:正在删除请稍候
然后在弹出页自动关闭并刷新xxx.asp
我就是这样实现的,还好看还简单。
------解决方案--------------------
http://www.webshu.com/tutorial/tor/7,id=0408.htm
lz参考这个!
------解决方案--------------------
可以用 XMLHTTP 方式执行你的页面

'-----------------------检索数据,返回结果-----------------------------------
'Post方式提交数据并返网页内容
'参数:A_strURL - 网页地址
'   A_strData - 提交内容,格式:A1=a1&A2=a2&A3=a3....
Function PostWebData(byval A_strUrl,byval A_strData)
On Error Resume Next
Dim MM_objBytesStream
dim MM_objHttp
Set MM_objHttp = Server.CreateObject( "Msxml2.ServerXMLHTTP ")
Set MM_objBytesStream = Server.CreateObject( "ADODB.Stream ")
MM_objHttp.Open "POST ", A_strUrl, False, " ", " "
MM_objHttp.setRequestHeader "CONTENT-TYPE ", "application/x-www-form-urlencoded "
MM_objHttp.Send (A_strData)
With MM_objBytesStream
.Type = 2
.Open
.WriteText MM_objHttp.Responsebody
.Position = 0
.Charset = "gb2312 "
.Position = 2
PostWebData=.ReadText
.close
End With
PostWebData=Replace(PostWebData, "无法找到网页 ", "Error ")
PostWebData=Replace(PostWebData, "刷新该网页 ", "Error ")
If Err Then
Err.Clear
PostWebData= "Http Error "
End If
Set MM_objBytesStream = Nothing
Set MM_objHttp = Nothing
End Function

调用方法:
(自定义字符串:RetrunContent;)
RetrunContent = PostWebData( "页面地址 ", "相关参数 ")

RetrunContent接收才是这个页面执行后的源代码,其中在出现错误的时候会返回 "Error "