JS打开图片另存为对话框
By admin
- One minute read - 26 wordsNew Document
function downLoadImage(imagePathURL){
//如果中间IFRAME不存在,则添加 if(!document.getElementById(“_SAVEASIMAGE_TEMP_FRAME”)) jQuery(‘ width=”0″ height=”0″ src=”about:blank”>’).appendTo(“body”);
if(document.all._SAVEASIMAGE_TEMP_FRAME.src!=imagePathURL){ //图片地址发生变化,加载图片 document.all._SAVEASIMAGE_TEMP_FRAME.src = imagePathURL; }else{ //图片地址没有变化,直接另存为 _doSaveAsImage(); } } function _doSaveAsImage(){ if(document.all._SAVEASIMAGE_TEMP_FRAME.src!=”about:blank”) document.frames(“_SAVEASIMAGE_TEMP_FRAME”).document.execCommand(“SaveAs”); }
//–>