找回密码
 注册
【阿里云】2核2G云新老同享 99元/年,续费同价华为云精选云产品特惠做网站就用糖果主机Jtti,新加坡服务器,美国服务器,香港服务器
楼主: 金光

[GG广告相关]放置GOOGLEAD的一个JS完整代码

[复制链接]
发表于 2005 年 8 月 6 日 20:21:52 | 显示全部楼层
呵呵
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2005 年 4 月 23 日 07:05:24 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价

[GG广告相关]放置GOOGLEAD的一个JS完整代码

  1. <!-- AD rotator script written entirely in javascript -->
  2. function runCode() //定义一个运行代码的函数,
  3. {
  4. var code=event.srcElement.parentElement.children[0].value;//即要运行的代码。
  5. var newwin=window.open('','',''); //打开一个窗口并赋给变量newwin。
  6. newwin.opener = null // 防止代码对论谈页面修改
  7. newwin.document.write(code); //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
  8. newwin.document.close();
  9. }
  10. function MM_findObj(n, d) { //v4.01
  11. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  12. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  13. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
  14. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
  15. if(!x && d.getElementById) x=d.getElementById(n); return x;
  16. }
  17. function MM_showHideLayers() { //v3.0
  18. var i,p,v,obj,args=MM_showHideLayers.arguments;
  19. for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
  20. if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
  21. obj.visibility=v; }
  22. }
  23. // AD Banner object
  24. function ADBanner(){
  25. this.htmlcode = "";// Non image banner's html code
  26. this.href = "";// Link's href attrib
  27. this.imgsrc = "";// Image's src attrib
  28. this.imgwidth = "";// Image's width attrib
  29. this.imgheight = "";// Image's height attrib
  30. this.imgalt = "";// Image's alt attrib
  31. this.imgborder = "";// Image's border attrib
  32. this.weight = 1;// Banner's show weight
  33. this.place = 1// Banner's place
  34. this.type = 1;// Banner's type
  35. }
  36. // Make Banner objects array
  37. function CreatBanners(aBanners, aNum){
  38. for( var i=0; i<aNum; i++ ){
  39. aBanners = new ADBanner();
  40. }
  41. }
  42. // Show banner
  43. function showbanner(aPlace, aType, aBannerID)
  44. {
  45. var amount = ADBanners.length;
  46. var includeList = new Array(amount);
  47. if (!document.usedBanners){
  48. document.usedBanners = new Array(amount);
  49. for (var i=0; i<amount; i++)
  50. document.usedBanners = -1;
  51. }
  52. var usedList = document.usedBanners;
  53. if (arguments.length == 2){
  54. var j = 0;
  55. var sum = 0;
  56. for(var i=0; i<amount; i++){
  57. if (ADBanners.place == aPlace && ADBanners.type == aType){
  58. if (usedList != i){
  59. includeList[j] = i;
  60. j++;
  61. sum = sum + ADBanners.weight;
  62. }
  63. }
  64. }
  65. if (sum <= 0)
  66. return;
  67. var rndNum = Math.round(Math.random() * sum);
  68. i = 0;
  69. j = 0;
  70. while (true) {
  71. j = j + ADBanners[includeList].weight;
  72. if (j >= rndNum)
  73. break;
  74. i++;
  75. }
  76. i = includeList;
  77. }
  78. else{
  79. if (aBannerID >= 0 && aBannerID < amount)
  80. i = aBannerID;
  81. else
  82. return;
  83. }
  84. usedList = i;
  85. if (ADBanners.htmlcode == "")
  86. document.write('<A HREF="'+ ADBanners.href +'" target=_blank><IMG SRC="'+ ADBanners.imgsrc +'" WIDTH="'+ ADBanners.imgwidth +'" HEIGHT="'+ ADBanners.imgheight +'" ALT="'+ ADBanners.imgalt +'" BORDER="'+ ADBanners.imgborder +'"></A>');
  87. else
  88. document.write(ADBanners.htmlcode);
  89. }
  90. var ADBanners = new Array();
  91. CreatBanners(ADBanners, 1);
  92. ADBanners[0].htmlcode = '<script type="text/javascript">google_ad_client = "pub-0614643359718668";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_channel ="";google_color_border = "FF4500";google_color_bg = "FFEBCD";google_color_link = "DE7008";google_color_url = "E0AD12";google_color_text = "8B4513";</script><script type="text/javascript" src="[url]http://pagead2.googlesyndication.com/pagead/show_ads.js[/url]"></script>';
  93. ADBanners[0].weight = 20;
  94. ADBanners[0].place= 6;
  95. ADBanners[0].type = 6;
  96. -------------------
  97. 此代码当中CreatBanners(ADBanners, 1); 这里的数字设置广告数量,如果只放一个GOOGLE就设置1了.,
  98. ADBanners[0].htmlcode = 这里里面填写GOOGLE AD的广告代码,请注意,必须写成一行
  99. ADBanners[0].place= 6;
  100. ADBanners[0].type = 6; 要调用的序号,具体偶不清楚,哈哈
  101. 弄好后,在网页HEAD中插入
  102. <script language="javascript" src="adbanner.js"></script>
  103. 在要放广告的地方插入
  104. <script language=javascript>showbanner(6,6);</SCRIPT>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2024 年 11 月 19 日 23:19 , Processed in 0.018957 second(s), 13 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表