[英]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.