3

我有以下代码:

 <input type="button" onclick="if(confirm('you wanna download?')){                                                                                                                            
 document.getElementById('formId').action = '../export_csv.php';                                                                                                                                                       
 document.getElementById('formId').submit();
 this.disabled = true; }"   />

如果我单击“确定”,浏览器“保存文件”对话框将出现在屏幕上。当用户在该对话框上按“是”时,我想添加一个警报。有谁知道该怎么做?

4

1 回答 1

0

您可以使用以下代码打开保存对话框。

javascript:document.execCommand('SaveAs','1','fileName.txt')"
于 2012-06-14T12:55:26.617 回答