如何从当前标签的左侧打开新标签页中的链接?

时间:2017-03-31 06:07:07

标签: jquery html css

我正在开发一个HTML项目,我无法找到如何从当前标签的左侧打开新链接,默认情况下从右侧打开,所以我想要在左侧的新标签页中打开。有什么想法吗?

链接

1 个答案:

答案 0 :(得分:0)

<html>
    <head></head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
       $('#link').click(function(){
           var win = window.open('demo.html', '_blank');
           win.focus(); // opens current page in new tab
       }); 
    });
    </script>
    <body>
        <a id="link" href="new.html" target="_top">Ads link</a>
    </body>
</html>