点击图片能另存图片的js

<script>
function getimg() {
event.returnValue=false;
show.window.location.href=event.srcElement.src;//在隐藏帧中加载图片
//100毫秒后在id为temp的隐藏帧上执行saveas命令 
timer=setInterval(checkload,100)
}
function checkload(){
if(show.readyState!="complete")
{show.document.execCommand("SaveAs");
  clearInterval(timer)}
}
</script>


<img src="logo.jpg" onclick="getimg()">
<iframe src="" name=show style="width:0;height:0; display:none;"></iframe>

by 雪洁 2010-04-03 15:39:09 6171 views
我来说几句

相关文章