阅读:3265回复:3
问一个firefox下javascript的问题下面这个文件在ie下运行没有什么问题,但是在firefox下却不能正常运行。 功能很简单,就是用另外一个按钮点击打开选择文件对话框,而不用一般的 类型为file的input. 不知道是哪里有问题,有人知道吗? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title></title> <script language=javascript> <!-- function OpenFile() { //document.getElementById("btnTest").click(); // 这句没有问题 document.getElementById("fileInput").click(); // 这句无论如何都打不开对话框, 只在ie下可以 } //--> </script> </head> <body> <p><input type="file" id="fileInput" size="100"></p> <p><button id="btnTest" onclick="alert('Test clicked')">Test</button></p> <p><button onclick="OpenFile()">Open...</button></p> </body> </html> |
|
1楼#
发布于:2005-09-26 22:30
.click() 是 IE only。
|
|
|
2楼#
发布于:2005-09-26 22:30
不是IE Only的问题,终于让我给找到了,是Firefox的Bug:
Can't send click event to "Browse..." button of File Upload control https://bugzilla.mozilla.org/show_bug.cgi?id=201178 |
|
|
3楼#
发布于:2005-09-26 22:30
果然。
![]() |
|
|