.click()在FireFox上不起作用? [英] .click() not workin on FireFox ??

查看:116
本文介绍了.click()在FireFox上不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅此代码.
click()不适用于FireFox,但适用于IE.

see this code guys.
click() doesn''t work on FireFox but it''s working on IE.

<script>
function attachFile(){
  document.getElementById("file").click(); 
}
</script>

<form name="novsh" style="margin: 0px; padding: 0px;">
    <input type="file" name="file" style="display:none" id="file" />
</form>

<a href="javascript:attachFile()">Attach File</a>
<input type="button" name="btn" value="click me" onclick="attachFile()" />


关于T.


Regard T.

推荐答案

可能是FF无法解析给定的控件名称.

好的,首先在单击行之前放置一个警报,以查看document.getElementById("file")是否显示为对象.

如果是这样,请对其进行调试,然后检查是否在"document .getElementById("file")"中单击了事件.

P.S .:在FF中执行所有这些操作,以解决问题所在.
如果您确定之后可以解决问题,或者告诉我们您找到了什么.
It might be FF is not resolving the name of control as given.

Ok, first of all put an alert just before click line and see if document.getElementById("file") is being shown as Object or not.

If so, debug it and check that whether ''document.getElementById("file")'' has the event click in it.

P.S.: perform all these in FF as thats where the issue is.
If you are able to resolve after this ok, or else tell us what you find.


这篇关于.click()在FireFox上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆