复制代码 代码如下:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<a href="a.txt" id=pic1 onclick="savepic();return false;" style="cursor:hand">点击下载</a>
<script>
function savepic()
{
if(document.all.a1==null)
{
objIframe=document.createElement("IFRAME");
document.body.insertBefore(objIframe);
objIframe.outerHTML= "<iframe name=a1 style='width:0;hieght:0' src="/UploadFiles/2021-04-02/+pic1.href+"> re=setTimeout("savepic()",1)
}
else
{
clearTimeout(re)
pic = window.open(pic1.href,"a1")
pic.document.execCommand("SaveAs")
document.all.a1.removeNode(true)
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<a href="a.txt" id=pic1 onclick="savepic();return false;" style="cursor:hand">点击下载</a>
<script>
function savepic()
{
if(document.all.a1==null)
{
objIframe=document.createElement("IFRAME");
document.body.insertBefore(objIframe);
objIframe.outerHTML= "<iframe name=a1 style='width:0;hieght:0' src="/UploadFiles/2021-04-02/+pic1.href+"> re=setTimeout("savepic()",1)
}
else
{
clearTimeout(re)
pic = window.open(pic1.href,"a1")
pic.document.execCommand("SaveAs")
document.all.a1.removeNode(true)
}
}
</script>
标签:
JS,点击,下载
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“JS实现点击下载的小例子”评论...