用js 文件导入方式放GG广告

昨天自己的站要放GG AD了,但网站全是静态页面,但我想随便更新GG AD 所以就想到用js文件导入方式,也可以用.php文件导入方式做的,下面来讲讲我的方法:

先来看看,直接在源码中放GG AD很多人都这样放:

<script type="text/javascript"><!–google_ad_client = "pub-6219414158063594";/* 468×15, 创建于 08-3-10 */google_ad_slot = "2571270205";google_ad_width = 368;google_ad_height = 20;//–></script><script type="text/javascript"src=""></script>

这样做有一个很大的不方便之处就是我更换不方便,下面我们来看看用js.文件导入形式.

我在网页源代码中放<script src=’/gg_ad/gg.js’></script>

在gg.js文件中放入上面的代码,但因为是js文件所以我们就得去了不必要的符号,代码如下:

google_ad_client = "pub-6219414158063594";google_ad_slot = "7794600866";google_ad_width = 234;google_ad_height = 60;google_cpa_choice = "";

document.write(‘<script type="text/javascript"src=");

还有一种就是有js入导php文件,看例:

<script src=’js.php’></script>在js.php里面这样写,

document.write(‘google_ad_client = "pub-6219414158063594";’);其它的写法一样这里就不多说了.

注明:原创,转载请注明原处.

未经一番寒彻骨,焉得梅花扑鼻香

用js 文件导入方式放GG广告

相关文章:

你感兴趣的文章:

标签云: