“文件对话框取消”事件在JavaScript中 [英] "On file dialog cancel" event in JavaScript
问题描述
我有一个文件输入:
< input type = file id = file onchange ='foo(this.files )'/>
函数'foo'仅在用户在文件上传对话框中选择某个文件时调用,并单击确定。用户点击对话框中的取消按钮时是否会触发任何事件?
只有HTML5的解决方案才行。
我认为如果您可以更改一下代码,正在添加插件来添加文件,例如:
或
这些比较常见,我会与首先,我没有任何问题。
这不会完全符合您的要求,但您可以在队列中添加文件,然后取消它们,并且可以捕获此事件...
我知道这不是你要找的东西,但是我可以给你的最好的解决方案
祝你好运!我希望我已经帮助你
I have a file input:
<input type=file id=file onchange='foo(this.files)'/>
Function 'foo' is called only when user chooses some file in the file upload dialog and clicks "OK". Is there any event that will be fired when user clicks "cancel" button in the dialog? HTML5-only solutions are OK.
I think that the best way if you can change a bit your code, is adding plugins to add files, for example:
or
these are the more common, I'd work with the first and I had no problems.
This will not do exactly what you want, but you can add files in a queue and then cancel them, and you can capture this event...
I know that is not what you was looking for, but is the best solution I can give you
good luck! I hope I've helped you
这篇关于“文件对话框取消”事件在JavaScript中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!