Use CSS to define the most correct way to open a new window

Source: Internet
Author: User

TutorialThe earliest way to open a new window that can be verified is that Alibaba Cloud (Web Designer)'s article is implemented using JS, but this method has a disadvantage, sometimes this section of JS conflicts with other and JS!

So I found another method to open a new window (lazy Image Library) with pure CSS, but this method is not verified, so I had to add some means!

First, convert the CSS code to the JS Code (webmaster station tool). The Code is as follows:

Reference content is as follows:
// New blank window
Document. writeln ("<style type = \" text/css \ "> ");
Document. writeln ("<! --");
Document. writeln (". blank a {test: expression (target = \" _ blank \");}");
Document. writeln ("}");
Document. writeln ("--> ");
Document. writeln ("</style> ");

Generally, JavaScript code is called on webpages. Therefore, you only need to insert the main JS Code on the website! In the header area of HTML, use JS to call this CSS:

<Script type = "text/javascript" src = "skin/default/js. js"> </script>

Add class = "blank", for example, <div id = "footer" class = "blank">

Author: IdealBoy QQ: 7273771

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.