js实现在新标签页打开页面
这种方法打开新标签页要在IE9+以上浏览器才可以!
<html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Title</title> <script src="jquery.js"></script> <script type="text/javascript"> $(function() { $("#btn").click(function() { //var a = $('a')[0]; var a = $("<a href='http://www.baidu.com' target='_blank'>百度</a>").get(0); var e = document.createEvent('MouseEvents'); e.initEvent('click', true, true); a.dispatchEvent(e); console.log('event has been changed'); }); }); </script> </head> <body> <input type="button" value="百度" id="btn"> </body> </html>