About Javascript:void (0) performance in unused browsers

Source: Internet
Author: User

The reason is that three browsers have different processing order for three properties.
Chrome Order: onclick, href-and target
IE and Firefox order: href---target---

And my need is to click on the a tag to execute a method before opening a new window.

                   <Divclass= "Form-group col-md-1">                                <aID= "Exportbtn"href="javascript:void (0)" class= "btn btn-primary btn-block pull-right"Target= "_blank"onclick= "Addparams ();">Export orders</a>                   </Div>

A tag is written so that Chrome opens a window and Firefox opens two windows.

After reviewing the data, you only need to execute return false on the onclick to terminate the subsequent operation.


       <Divclass= "Form-group col-md-1">                                <aID= "Exportbtn"class= "btn btn-primary btn-block pull-right"Target= "_blank"onclick= "Addparams (); return false;">Export orders</a>       </Div>

Can solve the problem of inconsistent behavior of two browsers, can only open a window or link correctly.


About Javascript:void (0) performance in unused browsers

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.