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