2、當(dāng)你想更換廣告樣式的時候,不必重新生成所有頁面。
1、使用html/js轉(zhuǎn)換器將adsense廣告代碼轉(zhuǎn)換成js格式(以下是樣本)
document.writeln(”<script type=\”text\/javascript\”><!–”);
document.writeln(”google_ad_client = \”pub-************\”;”);
document.writeln(”google_ad_width = 468;”);
document.writeln(”google_ad_height = 15;”);
document.writeln(”google_ad_format = \”468×15_0ads_al_s\”;”);
document.writeln(”google_ad_channel = \”\”;”);
document.writeln(”google_color_border = \”FFFFFF\”;”);
document.writeln(”google_color_bg = \”FFFFFF\”;”);
document.writeln(”google_color_link = \”3FA600\”;”);
document.writeln(”google_color_text = \”000000\”;”);
document.writeln(”google_color_url = \”008000\”;”);
document.writeln(”\/\/–><\/script>”);
document.writeln(”<script type=\”text\/javascript\”");
document.writeln(” src=\”http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\”>”);
document.writeln(”<\/script>”);
2、將這些js代碼保存在一個js文件中(例如ggad.js,保存于網(wǎng)站的js文件夾)
3、在需要放置廣告的地方使用如下代碼調(diào)用:
<div><script language=”JavaScript” src=”/js/ggad.js” mce_src=”/js/ggad.js” type=”text/javascript”></script></div>