網(wǎng)(LieHuo.Net)教程 經(jīng)過(guò)向Google AdSense 小組咨詢確認(rèn),Google AdSense 允許站長(zhǎng)使用js調(diào)用Google AdSense 廣告,下面我們來(lái)講講具體如何調(diào)用:
首先用記事本寫一個(gè)js文件,將google廣告的代碼粘貼進(jìn)去:查找替換所有的 " 字符,將其全部換成 " ,然后查找所有的 / 字符將其換成 / 。
然后,在每一行的開(kāi)頭加上: document.writeln(" 在結(jié)尾處加上 ");
這樣google廣告的js文件就做好了。
推薦非常簡(jiǎn)單的方法,直接利用HTML/JS轉(zhuǎn)換工具,直接將GG廣告代碼轉(zhuǎn)換為JS方式,工具地址:http://tool.liehuo.net/tool/html_js.asp
然后將你的google廣告的js文件上傳到你的網(wǎng)站的一個(gè)文件夾下面。這樣通過(guò)調(diào)用js文件的方法就可以使用google的廣告了。
下面是一個(gè)網(wǎng)站的js代碼(Google_Liehuo.js):
以下為引用的內(nèi)容: document.writeln(”<script type=”text/javascript”><!–"); document.writeln(”google_ad_client = ”pub-********************”;"); //注意修改前邊的星號(hào)為你的發(fā)布商代碼 document.writeln(”/* 728×90, 創(chuàng)建于 09-5-4 */”); document.writeln(”google_ad_slot = ”**************”;"); //注意修改前邊的星號(hào)為你的實(shí)際代碼 document.writeln(”google_ad_width = 728;”); document.writeln(”google_ad_height = 90;”); document.writeln(”//–>”); document.writeln(”</script>”); document.writeln(”<script type=”text/javascript”"); document.writeln(”src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>"); document.writeln(”</script>”); |