简体   繁体   中英

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 onclick 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:

  1. Make a div , height 100% of the page, width 100% of the page.
  2. This div is hidden.
  3. Make a function showDiv() that shows your div .
  4. On every action in your page you'll use a JavaScript function.
  5. 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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM