【问题标题】:Want to display my advertisement when I click href link当我点击href链接时想要显示我的广告
【发布时间】:2015-03-20 21:07:14
【问题描述】:

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

<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;
}

这是我的功能

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>

它只是打开广告窗口,但我想打开上面提到的 xxxxx.html(即)脚本中使用的链接

【问题讨论】:

  • 它打开了一个空白窗口?
  • 请不要否认你就是一小时前提出这个问题的同一个人:stackoverflow.com/questions/29164301/…
  • 你好 Yerko Palma 它的开场广告弹出窗口,但我想自动点击该广告......

标签: javascript jquery html


【解决方案1】:

希望我做得很好:不要使用 return false 路径来继续导航。

HTML:

<a id="your_anchor" href="<?php the_permalink() ?>"  title="nothing" rel="bookmark">Click Here</a>

JS:

document.getElementById("your_anchor").addEventListener("click", function ()
{
  window.open("http://www.yoursite/xxxxx.html", '_blank'); 

}

新窗口打开,用户继续导航到 ?php the_permalink() ?页面,例如:http://jsfiddle.net/041ammg4/

【讨论】:

  • 它工作正常 MR.Silent Tremor,但在 xxxxx.html 文件中我给出了一个广告脚本。单击 xxxxx.html 时,广告弹出窗口已正确打开,但我想单击 xxxxx.html(即)广告弹出窗口中编写的脚本。这是我的实际问题,所以请帮我解决这个问题......
  • 我不懂你,你想点击脚本,意思是你想在新打开的窗口中模拟点击,女巫你没有控制(添加),假用户点击,那是你的问题?
  • 在 xxxxx.html 我给出了一个脚本。但是当我点击 xxxxx.html 时,它会打开像谷歌广告一样的框窗口,然后我再次点击该广告链接,然后只进入广告页面。所以(当我点击 xxxxx.html 时,它直接进入广告页面)-->这是我的实际需要,所以请帮助我..
  • 打开的添加窗口是你的代码吗?如果是,在打开的窗口中加载后添加 $("your link rule").click();并在此处查看如何关闭整个 shebang stackoverflow.com/questions/19761241/…
  • 对不起,您的链接对我没有用...请正确阅读我的问题
猜你喜欢
  • 2013-12-21
  • 2017-01-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多