如何调用IE右键的菜单功能?已经放了三天了无人能答。

bluecoff 2003-08-07 09:23:41
情形描述:有一张图片显示在网页上,单击右键出现菜单,用其中一项“图片另存为...”就可以将图片保存到本地。

想实现的目标:用单击去调用这个“图片另存为...”如何实现?,单击图片也好,或者单击一个超链接也行,只要这个功能。

thank you.
...全文
119 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluecoff 2003-08-07
  • 打赏
  • 举报
回复
re无名为名,非常感谢,但还是不合适,因为这是在服务器ASP上运行的,且要在服务器上建两个ASP组件,不太可行。
随风奔跑 2003-08-07
  • 打赏
  • 举报
回复
文件代码。(该代码为转载代码)
<%@ Language=VBScript %>
<%
Dim filename
filename = Trim(Request("filename"))
if filename<>"" and not isnull(filename) then filename=Replace(Replace(filename,"/",""),"\","")
call downloadFile(filename)
Function downloadFile(strFile)
strFilename = server.MapPath(strFile)
Response.Buffer = True
Response.Clear
Set s = Server.CreateObject("ADODB.Stream")
s.Open
s.Type = 1
' load in the file
on error resume next
' check the file exists
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>")
Response.End
end if
' get length of file
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
Response.End
end if
' send the headers to the users browser
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite s.Read
Response.Flush
s.Close
Set s = Nothing
End Function
%>
随风奔跑 2003-08-07
  • 打赏
  • 举报
回复
这个该可以说是文件下载得问题把。
有歌大侠写的download的文件,可以直接传递参数给该文件,
然后该文件会提示用户保存指定得文件,而且可以下载ie都能默认显示
得word文档等。
bluecoff 2003-08-07
  • 打赏
  • 举报
回复
onestab(一刺) ,可这只对图片有效,AVI或PDF或其他媒体文件的超链接呢?
sw47 2003-08-07
  • 打赏
  • 举报
回复
在经典不是有答案了么?
方工 2003-08-07
  • 打赏
  • 举报
回复
<SCRIPT LANGUAGE="JavaScript">
function saveTo ()
{
var w = window.open("image001.gif");
w.document.execCommand('SaveAs', null, 'image001.gif');
w.close();
}
</script>
<img src="image001.gif" width="543" height="492" border=0 alt="click to save" onclick="saveTo()">
cnhxjt 2003-08-07
  • 打赏
  • 举报
回复
UP!!
notesboy 2003-08-07
  • 打赏
  • 举报
回复
顶。。。。。。。。。。。。。。
to 一刺:
你的方法虽然有用,但是调用的是ie中另存为的功能。如果附件为操作系统未识别的文件类型,另存的时候可能导致文件后缀名改掉。另外还有弹出的对话框也是另存的窗口,最下面还有选择语言的项。
在ie中选中附件的时候,右键单击弹出菜单中有目标另存为一项,不知道大家能不能做到象这样的功能。
方工 2003-08-07
  • 打赏
  • 举报
回复
onestab(一刺) ,可这只对图片有效,AVI或PDF或其他媒体文件的超链接呢?
〉〉可以,道理一样的。

87,988

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧