我想实现点击按钮弹出保存文件对话框 选择保存地址 然后点击另一个按钮能将文件保存到选择好的地址那 文件是用ocx从本地usbkey里读出的
下面贴出来代码 先实现弹出保存文件对话框这个功能这是单独的一个js文件
var fileName = "";
function getFilePath(){
var fileDialog =document.getElementById("fileDialog");
fileDialog.CancelError=true;
try{
fileDialog.Filter="Image Files (*.gif)|ALL Files (*.*)|*.*";
fileDialog.ShowSave(); //这条执行不了?不知道怎么个情况
alert("印章文件将被导入"+fileDialog.filename);
}catch(e){
}
}
function exportSeal(){
if(fileName==""){
alert("请选择要导出的文件");
return;
}
}
下面是jsp页面的代码 <body >
<object id="fileDialog" align="middle" width="20" height="20" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB"></object>
<fieldset>
<legend>导出</legend>
<form>
<input type="button" value="选择路径" onclick="getFilePath()">
<input type="button" value="导出" onclick="exportSeal()">
</form>
</fieldset>
</body>还有实现这个功能是用comdlg32么 还是用别的什么?在线等解答 自己找了网上的几个例子试了试也是调不通~郁闷死了
下面贴出来代码 先实现弹出保存文件对话框这个功能这是单独的一个js文件
var fileName = "";
function getFilePath(){
var fileDialog =document.getElementById("fileDialog");
fileDialog.CancelError=true;
try{
fileDialog.Filter="Image Files (*.gif)|ALL Files (*.*)|*.*";
fileDialog.ShowSave(); //这条执行不了?不知道怎么个情况
alert("印章文件将被导入"+fileDialog.filename);
}catch(e){
}
}
function exportSeal(){
if(fileName==""){
alert("请选择要导出的文件");
return;
}
}
下面是jsp页面的代码 <body >
<object id="fileDialog" align="middle" width="20" height="20" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB"></object>
<fieldset>
<legend>导出</legend>
<form>
<input type="button" value="选择路径" onclick="getFilePath()">
<input type="button" value="导出" onclick="exportSeal()">
</form>
</fieldset>
</body>还有实现这个功能是用comdlg32么 还是用别的什么?在线等解答 自己找了网上的几个例子试了试也是调不通~郁闷死了
解决方案 »
- 漂浮广告 碰到网页边缘弹回的效果 怎样让它正常 不在一行蹦跶。。。
- 求url复杂传参的最美写法。
- iframe添加事件问题
- 请教一个正则补全的问题
- JS高手进,怪事年年有,这个特别怪!
- 图象层定位问题?
- 请问一下,我的字符串里面既有中文,又有html代码,我只想取中文,其他的东西全都去掉,应该怎么写啊
- 都已经alert出来了,可是为什么并不到新的页面呢?
- 求救:如何在客户端得到服务器端变量的值,服务器端程序为a.asp,客户端程序为b.asp,急急,在线等待。。
- 在表格中,每一行都有一个hidden ,hidden 名规律,请问如何,点击某一行时,显示相对应hidden的值?
- try catch传出局部变量值的问题
- jQuery 求和
2、浏览器的安全问题,把当前站点加到信任站点,再调整信任站点的安全级别
这个ocx需要一个注册文件,名字是:comdlg.lpk,
在ie中调用需要这样用:HTML code <OBJECT CLASSID='clsid:5220cb21-c88d-11cf-b347-00aa00a28331'> <PARAM NAME='LPKPath' VALUE='/resource/comdlg.lpk'> </OBJECT> <OBJECT CLASSID='CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB' CODEBASE='/resource/comdlg32.cab'></OBJECT>这个是comdlg.lpk的代码,如果不能用,告诉我邮箱地址,发给你HTML code LPK License Package ////////////////////////////////////////////////////////////////////////////// // WARNING: The information in this file is protected by copyright law // // and international treaty provisions. Unauthorized reproduction or // // distribution of this file, or any portion of it, may result in severe // // criminal and civil penalties, and will be prosecuted to the maximum // // extent possible under the law. Further, you may not reverse engineer, // // decompile, or disassemble the file. // ////////////////////////////////////////////////////////////////////////////// {3d25aba1-caec-11cf-b34a-00aa00a28331} mWXDqNF2ekGyVjg4QtBySg= AQAAAA= hTwE+fL2GhCjyQgAKy9J+yQAAAA yADgAQwA0AEMAOAAyADAALQA0ADAAMQBBAC0AMQAwADEAQgAtAEEAMwBDADkALQAw ADgAMAAwADIAQgAyAEYANAA5AEYAQgA=
在网页里就是提示 网页上有错误