js难题,高手请进 200
<script>varfrm=null;vartimer=nullfunctionDownLoad(url){frm=document.createElement("IF...
<script>
var frm = null;
var timer = null
function DownLoad(url)
{
frm = document.createElement("IFRAME");
frm.style.display = "none";
document.body.appendChild(frm);
frm.contentWindow.location.href = url
timer = setInterval(checkload,200);
}
function checkload(){
if( frm.contentWindow.document.readyState =="complete")
{
frm.contentWindow.document.execCommand("SaveAs");
clearInterval(timer)}
document.body.removeChild(frm);
}
</script>
</head>
<body>
<div>
<div><img src="http://218.240.151.195/d3/img/1.jpg" id="DemoImg" border="0"> </div>
<a href="#" onclick="DownLoad(document.getElementById('DemoImg').src)"> 下载图片 </a>
</div>
</body>
</html>
图片路径改为本地可以直接弹出框另存,夸服务器了就不行了;有什么可以解决的办法 展开
var frm = null;
var timer = null
function DownLoad(url)
{
frm = document.createElement("IFRAME");
frm.style.display = "none";
document.body.appendChild(frm);
frm.contentWindow.location.href = url
timer = setInterval(checkload,200);
}
function checkload(){
if( frm.contentWindow.document.readyState =="complete")
{
frm.contentWindow.document.execCommand("SaveAs");
clearInterval(timer)}
document.body.removeChild(frm);
}
</script>
</head>
<body>
<div>
<div><img src="http://218.240.151.195/d3/img/1.jpg" id="DemoImg" border="0"> </div>
<a href="#" onclick="DownLoad(document.getElementById('DemoImg').src)"> 下载图片 </a>
</div>
</body>
</html>
图片路径改为本地可以直接弹出框另存,夸服务器了就不行了;有什么可以解决的办法 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询