是应该用这个函数么?document.execCommand
比如document.execCommand("SaveAs",true,"E:\test\1.jpg");把文件保存到E:\test\下命名为1.jpg?我程序里相关部分代码
function getimg()
{
event.returnValue=false;
//paramIframe.window.location.href=event.srcElement.src;
timer=setInterval(checkload,10);
}
function checkload()
{
if(paramIframe.document.readyState=="complete")
{
clearInterval(timer);
paramIframe.document.execCommand("SaveAs");
//paramIframe.document.execCommand("SaveAs",true,"E:\test\1.jpg");
//alert("save completed!");
}
else if(paramIframe.document.readyState=="interactive")
{
clearInterval(timer);
paramIframe.document.execCommand("SaveAs",true,"E:\test\2.jpg");
}
}
比如document.execCommand("SaveAs",true,"E:\test\1.jpg");把文件保存到E:\test\下命名为1.jpg?我程序里相关部分代码
function getimg()
{
event.returnValue=false;
//paramIframe.window.location.href=event.srcElement.src;
timer=setInterval(checkload,10);
}
function checkload()
{
if(paramIframe.document.readyState=="complete")
{
clearInterval(timer);
paramIframe.document.execCommand("SaveAs");
//paramIframe.document.execCommand("SaveAs",true,"E:\test\1.jpg");
//alert("save completed!");
}
else if(paramIframe.document.readyState=="interactive")
{
clearInterval(timer);
paramIframe.document.execCommand("SaveAs",true,"E:\test\2.jpg");
}
}
目前我用ActiveX来做的,不过得需要加载自己做的插件。单纯用JS或者用自带的什么库之类的能实现吗?
using System.Net;
string fileName = @ "D:\\test.gif";
WebClient myWebClient = new WebClient();
myWebClient.DownloadFile("图片地址", fileName);