问题代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>   
<body>
<script type="text/jscript">   
 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="+picture.src+"></iframe>";   
  re=setTimeout("savepic()",1)   
  }   
  else   
  {   
  clearTimeout(re)   
  pic= window.open(picture.src,"a1")   
  pic.document.execCommand("SaveAs")   
  document.all.a1.removeNode(true)   
  }   
  }   
</script>
<img src="1.jpg" id="picture" /> 
<input type="button" onclick="return savepic();"  value="下载" />
</body>
</html>用户点击下载,弹出另存为的框,选择自己的本地的路径,保存图片,在IE6上可以正常运行的,
但是在firefox测试的时候出现
savepic is not defined
onclick(click clientX=647, clientY=308)HxHIO4Ql...BfQ%3D%3D (第 2 行)
[Break on this error] return savepic(); 错误,不知道是原因。
其实最终的目的:用户选择要下载的图片的ID,然后把图片传到用户指定的本地文件路径里,(用另存为获取本地路径信息) 在调试中,希望高手指导
<?php
$pic = array (
"1" => "1.png" ,
"2" => "2.jpg" ,
"3" => "3.jpg" ,
);
?>放到服务器的图片信息放到$pic的数组里,然后获取本地的路径信息,把图片传到本地的指定的路径里