First: the following code is for a in the jb51 style to open in a new window.
Copy codeThe Code is as follows:
<Script type = "text/javascript">
JQuery (document). ready (function ($) {$ ('. jb51 A'). attr ({target: "_ blank "});});
</Script>
Second:
Copy codeThe Code is as follows:
<Script src = "http://code.jquery.com/jquery-latest.js"> </script>
<Script type = "text/javascript">
// Open url in new a window
$ (Document). ready (function (){
$ ("A"). attr ("target", "_ blank ");
});
</Script>
Open external link in new window
Copy codeThe Code is as follows:
$ ('A [href ^ = "http: //"] ')
. Attr ("target", "_ blank ");
Third: For more convenient control
The target = "_ blank" attribute is not supported in XHTML 1.0 Strict. JQuery can solve this problem well and enable the webpage to be opened in a new window:
Copy codeThe Code is as follows:
$ ('A [@ rel $ = 'external'] '). click (function (){
This.tar get = "_ blank ";
});
/*
Usage:
<A href = "http://www.jb51.net/" rel = "external"> jb51.net </a>
*/