Javascript 要在单击href链接时显示我的广告吗

Javascript 要在单击href链接时显示我的广告吗,javascript,jquery,html,Javascript,Jquery,Html,您好,我正在使用下面的脚本显示我的广告 <a href="<?php the_permalink() ?>" onclick="func()" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a> 我正在使用onclick显示我的广告 <script> function func() { window.open("xxxxx.h

您好,我正在使用下面的脚本显示我的广告

<a href="<?php the_permalink() ?>" onclick="func()" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a>

我正在使用onclick显示我的广告

<script>
function func()
{
  window.open("xxxxx.html", '_blank');
  return false;
}

函数func()
{
window.open(“xxxxx.html”,“u blank”);
返回false;
}
这是我的职责

xxxxx.html是

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- xxxxxxxxxxxx -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxxxxxxxxxxxx"
     data-ad-slot="xxxxxxxxxxxxx"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

(adsbygoogle=window.adsbygoogle | |[]).push({});

这只是在打开广告窗口,但我想打开上面提到的xxxxx.html(即)脚本中使用的链接。希望我做得很好:不要使用return false path继续导航

Html:

}


新窗口打开,用户继续导航到?php_permalink()?页面,这里的示例:

它正在打开一个空白窗口?请不要否认你是一小时前问这个问题的同一个人:hello Yerko Palma,它打开了一个广告弹出窗口,但我想自动点击那个广告……这很好,Silent Tremor先生,但在xxxxx.html文件中,我给出了一个广告脚本。单击xxxxx.html时,广告弹出窗口已正确打开,但我想单击xxxxx.html(ie)广告弹出窗口中编写的脚本。这是我的实际问题,所以请帮我解决这个问题……我不明白你的意思,你想点击脚本,意思是你想在新打开的窗口中模拟点击,而不是控制(添加),假装用户点击,这是你的问题?在xxxxx.html中,我给出了一个脚本。但是,当我点击xxxxx.html时,它会像谷歌广告一样打开框窗口,然后我再次点击该广告链接,然后只进入广告页面。所以(当我点击xxxxx.html时,它会直接进入广告页面)-->这是我的实际需要,所以请帮助我..打开的添加窗口是您的代码吗?如果是,请在打开的窗口$加载后添加(“您的链接规则”)。单击();检查这里如何关闭整个shebang抱歉你的链接对我没有用处。。。请正确阅读我的问题
<a id="your_anchor" href="<?php the_permalink() ?>"  title="nothing" rel="bookmark">Click Here</a>
document.getElementById("your_anchor").addEventListener("click", function ()
{
  window.open("http://www.yoursite/xxxxx.html", '_blank');