- 本站大部分内容从网上收集,收集目的仅供研究、学习。涉及版权或不希望收录您的文章请您及时与我联系。
- 本站IM群,请自行选择。请各位朋友按照自己喜好加入。加入群后请及时发言,防止被清理。谢谢您的合作!!!
- QQ群:Y①WEB开发(ASP.NET)号码:7351660 QQ群:Y②WEB开发(ASP+.NET)号码:11864905
- QQ群:Y③WEB开发(DIV+CSS)号码:16610506 QQ群:Y④WEB开发(JS+AJAX)号码:16143998
- QQ群:Y⑤WEB开发(新手)号码:12777715 MSN群:yaosansi[at]126.com
转载请标明出处: http://www.yaosansi.com
原文:http://www.yaosansi.com/post/1374.html
本代码摘自一国外博客源码.如使用以下代码请谨记做人要厚道,保留Ads by Google字样.
注:网易的新闻频道内容页有相似代码,可以参考.
声明:GOOGLE官方不推荐使用,如使用以下代码出现的任何问题本站不负责任.
效果
使用方法:
<script language="JavaScript" src="js/as_footer.js"></script>
<script language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
as_footer.js 内容:
function google_ad_request_done(google_ads) {
/** This function is required and is used to display* the ads that are returned from the JavaScript* request. You should modify the document.write* commands so that the HTML they write out fits* with your desired ad layout.*/var s = '';
var i;/** Verify that there are actually ads to display.*/if (google_ads.length == 0) {return;}
if (google_ads[0].type == "flash") {
s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +' WIDTH="' + google_ad.image_width +'" HEIGHT="' + google_ad.image_height + '">' +
'<PARAM NAME="movie" VALUE="' + google_ad.image_url + '">'
'<PARAM NAME="quality" VALUE="high">''<PARAM NAME="AllowScriptAccess" VALUE="never">''<EMBED src="' + google_ad.image_url +'" WIDTH="' + google_ad.image_width +'" HEIGHT="' + google_ad.image_height + '" TYPE="application/x-shockwave-flash"' + ' AllowScriptAccess="never" ' + ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';s += '<div class="gcoladby"><a href=\"' + google_info.feedback_url + '\" style="color:000000">Ads by Google</a></div>';
} else if (google_ads[0].type == "image") {
s += '<a href="' + google_ads[0].url +'" target="_top" title="go to ' + google_ads[0].visible_url +'"><img border="0" src="' + google_ads[0].image_url +'"width="' + google_ads[0].image_width +'"height="' + google_ads[0].image_height + '"></a>';
s += '<div class="gftradby"><a href=\"' + google_info.feedback_url + '\" style="color:000000">Ads by Google</a></div>';
} else { /* * For text ads, append each ad to the string. */ s += '<div class="gftradby">' +'<a href=\"' + google_info.feedback_url + '\">Ads by Google</a>' +
'</div></div>'; s += '<div id="footerads">'; for(i = 0; i < google_ads.length; ++i) { s += '<div class="gftrad">' +'<div class="title"><a href="' + google_ads[i].url + '" ' +
'onmouseout="window.status=\'\'" ' + 'onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'">' +'' + google_ads[i].line1 + '' +
'</a></div>' + '<div class="desc"> ' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '' +'<div class="url"><a href="' + google_ads[i].url + '" ' +
'onmouseout="window.status=\'\'" ' + 'onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'">' + google_ads[i].visible_url + '' + '</a></div>' + '</div>' + '</div>';}
}
document.write(s);
return;}
google_ad_client = 'pub-12345678'; // substitute your client_id (pub-#)
google_ad_channel = "123456789";google_ad_output = 'js';google_skip = '2'; google_max_num_ads = '5';google_ad_type = 'text_image';google_image_size = '336x280';google_feedback = 'on';
订阅本站,阅读更多文章