在部落格描述加入這個,轉自PIXNET 某個BLOG..忘了

 

<div id="divAdSenseContentScript" style="display:none;"><br />

插入google adsense程式碼

<br/>

</div>

<script type="text/javascript"> var isArticle = false;

if (document.URL.indexOf("/post/") > 0)

           isArticle = true;

 

if (isArticle)

{

           if (window.attachEvent)

                     window.attachEvent('onload', init);

           else

                     window.addEventListener('load', init, false);

}

 

function init()

{

// "Content" 是文章的主要區塊

var CONTENT = document.getElementById("article-box");

var DIVs = CONTENT.getElementsByTagName('div');

for (var i in DIVs)

{

var x = new String(DIVs[i].className);

if (x.indexOf("article-content") == 0)

{

DIVs[i].innerHTML += document.getElementById("divAdSenseContentScript").innerHTML;

break;

}

}

}

</script>

Felix 發表在 痞客邦 PIXNET 留言(0) 人氣()