〖另存为〗命令的实现 
  [格式]:document.execCommand("saveAs") 
  [说明]将该网页保存到本地盘的其它目录! 
  [举例]在<body></body>之间加入: 
  <a href="#" onclick=document.execCommand("saveAs")>另存为</a>

解决方案 »

  1.   

    onClick= 'window.location = "view-source:" + www.sohu.com;'
      

  2.   

    扬子同志:〖另存为〗我已经写在上面啦,我要实现的是〖目标另存为〗,应该怎么做?你笑我多情同志: 我要保存的是类型不定的二进制文件,不是普通的可显示的文本程序,如果显示的话,只会是乱码,必需按照文件原本的类型调用相应的程序才能正常显示,如果按MIME显示的话,第一次正常,以后就不正常了,所以才想让用户以程序原本的扩展名保存下来,再在客户端打开,有什么好的办法吗?
      

  3.   

    '----------------------------------------------------------------------------------------
    '       文件下载组件
    '       COPY 2002.8.29
    '       要专门提供一个页来下载可以是隐藏的iframe,比直接下载要慢,但可以在下载前提供安全保证
    '       并且存放路径不必为HTTP可以访问的路径
    '       参数是一个绝对的路径和下载后的存盘文件名
    '---------------------------------------------------------------------------------------------
    Function TransferFile(pathandfilename, filename)
            Dim objFileSystem, objFile, objStream
            Dim schar
            Dim sent
            sent = 0
            TransferFile = True        Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
            Set objFile = objFileSystem.GetFile(pathandfilename)
            Set objStream = objFile.OpenAsTextStream(1, -1)        Response.AddHeader "content-type", "application/x-msdownload"
            Response.AddHeader "Content-Disposition", "attachment;filename=" & filename
            Response.AddHeader "content-length", objFile.Size        Do While Not objStream.AtEndOfStream
                    schar = objStream.Read(1)
                    Response.BinaryWrite (schar)
                    sent = sent + 1
                    If (sent Mod 16384) = 0 Then
                            Response.Flush
                            If Not Response.IsClientConnected Then
                                    TransferFile = False
                                    Exit Do
                            End If
                    End If
            Loop        Response.Flush
            If Not Response.IsClientConnected Then TransferFile = False        objStream.Close
            Set objStream = Nothing
            Set objFileSystem = Nothing
    End Function