有人问起这个问题,现在根据google官方的答复,可以使用javascript调用adsense代码。
这个举措看来很有必要,因为将广告和内容分离,使得我们每次修改的时候不用重新生成html文件。
js调用广告的方法很简单,在需要插入广告的位置,把原有的javascript改为嵌入的代码,例如
<script src="/ads/adsense.js" type="text/javascript"></script>
一般的adsense代码如下:
<script type="text/javascript"><!--
google_ad_client = "pub-************************";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
google_ad_client = "pub-************************";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
但是在调用的时候需要进行一些改变,
