JavaScript Button.click() does not work in Firefox, works fine in Internet Explorer
I have an ASP.NET button on my page. When I click the button using JavaScript (buttonId.click()
), Firefox seems to fire all onc开发者_StackOverflow社区lick
event handlers on the page. I would like to click only one button.
This scenario is working fine in Internet Explorer.
Please let me know of any workarounds for this.
Thanks
The simple workaround is:
- Make a
div
,height 100%
of the page,width 100%
of the page. - This
div
is hidden. - Make a function
showDiv()
that shows yourdiv
. - On every action in your page you'll use a JavaScript function.
- The last row of all JavaScript function is
showDiv()
.
Then after every click that calls a JavaScript function other clicks on this page are disabled.
Ps. Obviously the div
need remains align to viewport (top=0;left=0
).
精彩评论