简体   繁体   English

当我单击href链接时要显示我的广告

[英]Want to display my advertisement when I click href link

Hello I am using the below script to display my advertisement 您好,我正在使用以下脚本显示我的广告

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

i am using onclick to display my advertisement 我正在使用onclick来显示我的广告

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

this is my function 这是我的职责

xxxxx.html is 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>

It is only opening the advertisement window but i want to open the link used in xxxxx.html (ie) script i denoted above 它只是打开广告窗口,但我想打开上面提到的xxxxx.html(即)脚本中使用的链接

Hope I did get it good: don't use return false path to continue navigation. 希望我做得很好:不要使用return false path继续导航。

Html: HTML:

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

JS: JS:

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

} }

New window open, user continue navigation to ?php the_permalink() ? 新窗口打开,用户继续导航到?php the_permalink()?。 page, example here: http://jsfiddle.net/041ammg4/ 页面,例如此处: http : //jsfiddle.net/041ammg4/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript.void 问题我想在单击 href 链接时看到页面新地址 - Javascript.void problem i want to see the page new adress when i click on a href link 当我单击链接时,标题没有href内容 - Does not get heading the href content When i click the link 当我单击Internet Explorer 11的href链接时出现错误 - Error when I click on href link with internet explorer 11 当我希望链接无处链接并使用它来运行脚本时,可以用作“ href”属性吗? - What to use as “href” attribute when i want a link to link nowhere and use it for running a script? 我想在单击时显示每个孩子的索引(编号) - I want to display the index (number) of each child when i click it 我可以触发点击href元素而不触发href链接吗? - Can I trigger click on href element without triggering href link? 我想当我点击 <a href=“whatever.aspx”></a> 在同一页面内显示页面 - I want when i click on <a href=“whatever.aspx”></a> show the page inside the same page 当我使用 Javascript 和 JQuery 单击显示按钮时,我想在显示模式中显示我的 td 的图像数据,但找不到 src 的路径 - I want to display the image data of my td in the show modal when I click on the show button using Javascript and JQuery but path of the src not found 单击链接时如何显示字段? (javascript) - How do I display field when I click on a link? (javascript) 如果我点击链接并且设置了自动点击,则会出现不同的 HREF - Different HREF if I click on the link and if I set an auto click
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM