当线程不包含任何破解或序列时,我想在 vbulletin 论坛上显示谷歌广告,所以我编写了以下代码:
<div id ="d_content"> post goes here...</div>
<div id="adv_content"></div>
<script>
function isBlank(str) {
return (!str || /^\s*$/.test(str));
}
var str = document.getElementById("d_content").innerHTML;
var pattern = /crack|nulled|serial|register|key|pach|patch/gi;
var Len= str.match(pattern);
if( isBlank(Len) ) document.write("adv..");
</script>
但是如何放置谷歌广告代码而不是“adv ..”这是我的尝试:
<div id ="d_content"> post goes here...</div>
<div id="adv_content"></div>
<script>
function isBlank(str) {
return (!str || /^\s*$/.test(str));
}
var str = document.getElementById("d_content").innerHTML;
var pattern = /crack|nulled|serial|register|key|pach|patch/gi;
var Len= str.match(pattern);
if( isBlank(Len) ) document.write("
<script type="text/javascript"><!--
google_ad_client = "ca-pub-1564912551365218";
/* 728x90, تم إنشاؤها 02/06/11 زهير طه */
google_ad_slot = "7785253845";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
");
</script>
但没有工作..