如何在新窗口中打开弹出广告

时间:2015-04-28 04:56:01

标签: javascript html css

我每天每天有400名访客。我计划首先创建弹出广告,然后创建弹出广告以在新窗口中打开。这让游客感到不安。

我的新窗口弹出代码

var firstClick = true;
document.body.onclick = function() {
    if (firstClick) {
        window.open('popup creating website', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=950, height=650, left = 300, top = 50');
        window.open('popup creating second website', 'poppage2', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=950, height=650, left = 200, top = 10');
        firstClick = false;
    }
}
  

我计划得到的是首先点击网页打开新标签页。

谢谢

2 个答案:

答案 0 :(得分:-2)

您可以使用目标属性在新标签页中打开

  

实施例

<a href="#" target="blank">click here</a>

答案 1 :(得分:-2)

您需要在超链接中使用“target = _blank”

 $(document).ready(function(){   
     $('#newtab').click(function() {   
     $(this).target = "_blank";
     window.open($(this).prop('href'));   
     return false; 
     });
  });​

<a href="link" id="newtab" >new tab</a>
相关问题