首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript兑现另存为对话框

2012-09-13 
javascript实现另存为对话框html headtitle New Document /titlemeta nameGenerator content

javascript实现另存为对话框

<html> <head>  <title> New Document </title>  <meta name="Generator" content="EditPlus">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">  <script src="jquery-1.3.js" type="text/javascript"></script>  <script language="JavaScript">  <!--    function downLoadImage(imagePathURL){        //如果中间IFRAME不存在,则添加        if(!document.getElementById("_SAVEASIMAGE_TEMP_FRAME"))            $('<iframe style="display:none;" id="_SAVEASIMAGE_TEMP_FRAME" name="_SAVEASIMAGE_TEMP_FRAME" onload="_doSaveAsImage();" width="0" height="0" src="about:blank"></iframe>').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.getElementById('_SAVEASIMAGE_TEMP_FRAME').document.execCommand("SaveAs");            }  //-->  </script> </head> <body>  <input type="button" value="download image" onclick="downLoadImage('r_beyond1991.jpg');">   </body></html>

?

<input   type="button"   value="保存"   onclick="document.execCommand('SaveAs')">   <input   type="button"   value="另存为"   onclick="document.execCommand('SaveAs',false,'c:\\oak.htm')"> 

?

热点排行