javascript实现将⽂件保存到本地⽅法汇总下⾯是保存⼀个图⽚为⽰例,代码来源于⽹络,希望能够给⼤家带来⼀定的帮助,代码如下:
<script type="text/javascript">
function saveFile(imgUrl)
{
var oPop=window.open(imgUrl,"","width=1, height=1, top=5000, left=5000");
for(;adyState != "complete"; )
{
if(adyState=="complete")break;
}
Command("SaveAs");
oPop.close();
}
</script>
</head>
<body>
<img src="../mytest.jpg" id="theimage" border="0">
<a href="#" onclick="ElementById('theimage').src)"> 点击这⾥下载图⽚ </a>
javascript动态效果</body>
</html>
⽅法⼆:
function SaveAs5(imgURL)
{
var Pop = window.open(imgURL,"","width=1, height=1, top=5000, left=5000");
for(; adyState != "complete"; )
{
if (adyState == "complete")break;
}
Command("SaveAs");
oPop.close();
}
<img src="t_screenshot_17616.jpg" id="DemoImg" border="0" onclick="SaveAs5(this.src)">
⽅法三:
function SaveAs5(imgURL)
{
var Pop = window.open(imgURL,"","width=1, height=1, top=5000, left=5000");
for(; adyState != "complete"; )
{
if (adyState == "complete")break;
}
Command("SaveAs");
oPop.close();
}
<img src="../t_screenshot_17616.jpg" id="DemoImg" border="0">
<a href="#" onclick="ElementById('DemoImg').src)"> 点击这⾥下载图⽚ </a>
以上所述就是本⽂的全部内容了,希望⼤家能够喜欢。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论