<input type=button value=另存为
  onclick=document.execCommand('Saveas',false,'c:\\test.htm')>

解决方案 »

  1.   

    存储文件需要比较高的权限,fso或者adodb.stream都可以做到
      

  2.   

    hrong(黄蓉)太厉害了这个方法解决了我的问题谢啦^_^
      

  3.   

    呵呵,借别人的帖子发一下!
    hrong(黄蓉)说的不错啊,确实可以这么做,
    不过能不能在下载的时候不允许用户修改路径的?
      

  4.   


    下载任何文件(尤其是IE关联打开的)
    第一个文件连接处这么写
    <a name="download" 
    href="<%if 是会员 then response.write "download.asp?filename="  & myfilename%>">
    下载<%=myfilename%></a>第二个文件:
    <%
    Dim Stream
    Dim Contents
    Dim FileName
    Dim FileExt
    Const adTypeBinary = 1
    FileName = Request.QueryString("FileName")
    if FileName = "" Then
        Response.Write "无效文件名."
        Response.End
    End if
    ' 下面是不希望下载的文件
    FileExt = Mid(FileName, InStrRev(FileName, ".") + 1)
    Select Case UCase(FileExt)
        Case "ASP", "ASA", "ASPX", "ASAX", "MDB"
            Response.Write "受保护文件,不能下载."
            Response.End
    End Select
    ' 下载这个文件
    Response.Clear
    Response.ContentType = "application/octet-stream"
    Response.AddHeader "content-disposition", "attachment; filename=" & FileName
    Set Stream = server.CreateObject("ADODB.Stream")
    Stream.Type = adTypeBinary
    Stream.Open
    Stream.LoadFromFile Server.MapPath(FileName)
    While Not Stream.EOS
        Response.BinaryWrite Stream.Read(1024 * 64)
    Wend
    Stream.Close
    Set Stream = Nothing
    Response.Flush
    Response.End
    %>
      

  5.   

    <script>
    function test(){
    if(document.queryCommandSupported('Print'))
    alert("支持Print命令!")
    else
    alert("不支持Print命令!")
    }
    </script><FORM METHOD=POST ACTION="">
    asdfdsfds
    <input onclick="test()" type=button value=测试是否支持该命令><br><br>
    <input onclick="document.execCommand('print',false,0)" 
    type=button value=打印><br>
    <input onclick="document.execCommand('SelectAll',false,null)" 
    type=button value=全选><br>
    <input onclick="document.execCommand('Refresh',false,null)" 
    type=button value=刷新本页><br>
    <input onclick="document.execCommand('SaveAs',false,'c:\\index.htm')" 
    type=button value=另存为[指定文件名和路径]><br>
    <input onclick="document.execCommand('SaveAs',false,null)" 
    type=button value=另存为[不指定文件名和路径]><br>
    <input onclick="document.execCommand('Unselect',false,null)" 
    type=button value=不选[请选定页面上的文字然后按这里]><br>
    <input onclick="document.execCommand('delete',false,null)" 
    type=button value=删除[请选定页面上的文字然后按这里]></FORM>