logo plain現在Google Adsense已經允許使用javascript調用adsense代碼。這樣做的好處是,對於那些生成html文件的程序,將廣告與內容分離之後,我們只要修改js文件就能改變我們的廣告樣式,而不用重新生成html文件。

js調用廣告的方法很簡單,在需要插入廣告的位置,把原有的廣告代碼改為嵌入的代碼,例如:

[code]
[/code]

但是在調用的時候需要進行一些改變:

[code]document.writeln(“ “);
document.writeln(“<\/script> “);
document.writeln(“
document.writeln(“src=\”http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\”> “);
document.writeln(“<\/script>”);
document.writeln(“”)[/code]


This Post Has 2 Comments

發表迴響