生成 3 个随机 ad.innerHTML HTML 代码
Generate 3 random ad.innerHTML HTML codes
我在下面有一个脚本,我想修改第 19 行以显示 3 个不同的预定义 html 标签。有人可以告诉我该怎么做吗?
谢谢。
<script>
// Run after all the page elements have loaded
window.onload = function(){
// This will take care of asynchronous Google ads
setTimeout(function() {
// We are targeting the first banner ad of AdSense
var ad = document.querySelector("ins.adsbygoogle");
// If the ad contains no innerHTML, ad blockers are at work
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
// Since ad blocks hide ads using CSS too
ad.style.cssText = 'display:block !important';
// You can put any text, image or even IFRAME tags here
ad.innerHTML = 'Your custom HTML messages goes here';
}
}, 2000); // The ad blocker check is performed 2 seconds after the page load
};
</script>
我得到答案了!
<script>
// Run after all the page elements have loaded
window.onload = function(){
// This will take care of asynchronous Google ads
setTimeout(function() {
// We are targeting the first banner ad of AdSense
var ad = document.querySelector("ins.adsbygoogle");
// If the ad contains no innerHTML, ad blockers are at work
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
// Since ad blocks hide ads using CSS too
ad.style.cssText = 'display:block !important';
//Add variables
var Ads = ["Ads 1", "Ads 2", "Ads 3"];
var displayAds = Ads[Math.floor(Math.random() *Ads.length)];
// You can put any text, image or even IFRAME tags here
ad.innerHTML = displayAds;
}
}, 2000); // The ad blocker check is performed 2 seconds after the page load
};
</script>
我在下面有一个脚本,我想修改第 19 行以显示 3 个不同的预定义 html 标签。有人可以告诉我该怎么做吗?
谢谢。
<script>
// Run after all the page elements have loaded
window.onload = function(){
// This will take care of asynchronous Google ads
setTimeout(function() {
// We are targeting the first banner ad of AdSense
var ad = document.querySelector("ins.adsbygoogle");
// If the ad contains no innerHTML, ad blockers are at work
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
// Since ad blocks hide ads using CSS too
ad.style.cssText = 'display:block !important';
// You can put any text, image or even IFRAME tags here
ad.innerHTML = 'Your custom HTML messages goes here';
}
}, 2000); // The ad blocker check is performed 2 seconds after the page load
};
</script>
我得到答案了!
<script>
// Run after all the page elements have loaded
window.onload = function(){
// This will take care of asynchronous Google ads
setTimeout(function() {
// We are targeting the first banner ad of AdSense
var ad = document.querySelector("ins.adsbygoogle");
// If the ad contains no innerHTML, ad blockers are at work
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
// Since ad blocks hide ads using CSS too
ad.style.cssText = 'display:block !important';
//Add variables
var Ads = ["Ads 1", "Ads 2", "Ads 3"];
var displayAds = Ads[Math.floor(Math.random() *Ads.length)];
// You can put any text, image or even IFRAME tags here
ad.innerHTML = displayAds;
}
}, 2000); // The ad blocker check is performed 2 seconds after the page load
};
</script>