Fra*_*ank 3 javascript adsense
我正在尝试将2个adsense代码添加到一个页面.当我这样做时,只显示一个(第一个定义的)并且页面似乎处于无限加载状态.
以下是包含示例插槽和客户端ID的代码.
<body>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxx";
google_ad_slot = 111111111;
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxx"; //the same like the first one client
google_ad_slot = 222222222;
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
如果我删除其中一个adSense代码而不是它的工作原理.如何使用这两个代码?
最后,经过近2个小时的谷歌搜索,我发现了它.我唯一要做的就是为google_ad_slot变量添加引号(哦,我的......).所以工作代码如下所示:
<body>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxx";
google_ad_slot = "111111111"; // see the quotes
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxx"; //the same like the first one client
google_ad_slot = "222222222";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Run Code Online (Sandbox Code Playgroud)
如果只有一个adSense代码,则整数插槽可以正常工作.如果添加另一个,则必须将所有插槽定义为字符串.
干杯!