过期域名预定抢注

 找回密碼
 免费注册

拖死狗還是JS!並發佈一段狗狗的JS代碼:)

[複製鏈接]
發表於 2005-3-15 09:19:38 | 顯示全部樓層 |閱讀模式
牽狗和拖死狗還是JS!方便快捷,狗死了只需刪除或重命名JS文件了事!
$ \$ w+ ~: D& t$ C2 g: ]' Y) V0 d: K, }# ^) [
現特發佈一段狗狗的JS代碼:)! B0 n, Q8 T. |
. |/ A/ _6 D2 P- p0 k. I
希望大家用得開心,有分的請加分,有精的請加精,謝謝:)7 ?8 M0 |/ q2 y( z% [8 j" O* `

* ]0 y. u. o1 ^7 ?4 [======================================6 O3 n3 g' \) F+ o3 f9 O

6 B2 P6 f- i& W, i首先建一個文件名為adbanner的JS,代碼如下:
  M5 V5 q2 ]0 @! D
5 ^: W; o4 G% J. C! C
2 ]% ~/ s' ]2 {3 k. B! s  CODE: [Copy to clipboard]   
6 J2 b3 L' C- N, K; N<!--  AD rotator script written entirely in JavaScript  -->
% F/ G- @6 y  U- y! U* R<!--  Written by WenWei, 2002/03/03. E-mail: [email protected]  -->- q$ b3 J! s9 z
<!--  ASP 2 JS Written by 小荷, 2003/05/28. E-mail: [email protected]  -->( z1 w1 b. v2 G' F0 C  Y) W+ o
<!--  Member Of Blueidea Web Team. -->/ ~3 U- S" W' [; l
<!--  Welcome to www.blueidea.com. -->3 I; u1 b9 u( N& @" p- X
# Z, Y+ [/ {( F2 Q6 E7 t
function runCode()  //定義一個運行代碼的函數,
5 R1 E, V& d0 J9 ?$ j{
. C0 U( q. k0 S+ z+ j- y( W  var code=event.srcElement.parentElement.children[0].value;//即要運行的代碼。
; A# a  R2 X- X. i. s  var newwin=window.open('','','');  //打開一個窗口並賦給變量newwin。  [& K$ m. f: `; A
  newwin.opener = null // 防止代碼對論談頁面修改
/ e0 U/ S& R1 Y6 j3 p7 t  newwin.document.write(code);  //向這個打開的窗口中寫入代碼code,這樣就實現了運行代碼功能。: H, @: W) w/ l  N
  newwin.document.close();
" @/ Y, k" _$ }  ~  H* J}( D6 m) r: b' {- S& ~

6 n. z* P$ H) U. ?  W- `function MM_findObj(n, d) { //v4.01
1 `; F: k$ ~+ Z, f4 R  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
; P  V% n5 g2 P! b& G# j3 i    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
3 R' |' a, U9 z2 t' _& Z* }  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
+ \9 ~7 z) X! q. x# i  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
/ A: o) C/ J1 K. Q- d5 Z) _# a  if(!x && d.getElementById) x=d.getElementById(n); return x;* P1 [. I3 y8 T
}# e( L1 w: u% R; c; d
; M* q2 Z* Y9 i/ q* z, Y
function MM_showHideLayers() { //v3.0. E. J. {2 T  j8 r% s' R" [
  var i,p,v,obj,args=MM_showHideLayers.arguments;
( F7 _. R5 C; I- Y4 s, K. f  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];/ Y' x- y& b" l6 h# b4 }* q
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v='hide')?'hidden':v; }
( e/ \& M" }+ f; W    obj.visibility=v; }
, Y) z1 i6 v! w- n8 R}7 o+ ~9 {9 }4 J6 s1 H5 Q  G2 `
+ T% z5 [: l- K; g  |
// AD Banner object
9 d3 M, v7 U: Z5 a5 m/ y8 {# o& {function ADBanner(){- l( G/ C; i# I2 r! M
  this.htmlcode  = "";// Non image banner's html code) o) g1 |+ Z1 Z* V) T' k
  this.href      = "";// Link's href attrib
' x, I- D: ?9 U) V  this.imgsrc    = "";// Image's src attrib
) `0 O; T9 n" x8 @6 E0 [; X/ j7 H- o  this.imgwidth  = "";// Image's width attrib
8 {% H3 H1 T' v0 p  k: I  this.imgheight = "";// Image's height attrib8 D0 w( n7 x/ k1 W/ Q
  this.imgalt    = "";// Image's alt attrib8 l; t1 Q3 v" N
  this.imgborder = "";// Image's border attrib" L, n: O! X" e1 H
  this.weight    = 1;// Banner's show weight8 s' D3 a5 Y% W" R" G
  this.place     = 1// Banner's place
- L/ P- j1 z6 U4 Y  this.type      = 1;// Banner's type% p/ j6 C# ]  D7 m* Q
}
) B! l1 F$ T4 n; W4 k
. i4 R: r0 C! I  a- h# T( H8 _// Make Banner objects array
1 _9 D+ `& k' kfunction CreatBanners(aBanners, aNum){9 {9 H) Y3 n- P3 O& _; _4 A9 h
  for( var i=0; i<aNum; i++ ){2 M! d& J: P( R/ T
    aBanners = new ADBanner();0 E5 Z" D0 I- U  d  b
  }
- B. N1 Q/ b# d. V3 x( Y}, }- A) O' [0 m1 M) V; [' d! q1 ~

( U' h" w$ P3 {5 Z+ k" N' o// Show banner
2 ]! w$ |% l' R0 a3 Z. h4 W- B, efunction showbanner(aPlace, aType, aBannerID)& g1 d, F0 p: N. E7 |: X$ c
{
1 ^7 M- w; a. r( s, ]  var amount = ADBanners.length;
8 m/ @  p# t7 B1 U, P- E  var includeList = new Array(amount);
. _# V, `4 I5 U* p+ |+ G; w8 R* q) D; A' W
  if (!document.usedBanners){1 ^4 D) d! g4 r2 j$ r) v: Y6 O
    document.usedBanners = new Array(amount);
0 F) J( B5 `: t6 o0 d7 zfor (var i=0; i<amount; i++)# W' y( Z: l4 T7 R1 i5 h
      document.usedBanners = -1;
9 |7 [0 [9 q+ g/ v& X1 a$ [  }9 r1 a9 N9 p+ O7 L& a& c
1 `  j- U( ]$ C$ q
  var usedList = document.usedBanners;
; M, E2 ~4 z0 f/ N" G5 y
! B; L+ y$ @/ Y* q9 v* i  if (arguments.length == 2){
2 |1 C- m! s) O$ n0 k' M- Q    var j = 0;
3 j- U3 O- N6 c    var sum = 0;9 G  s) G& B  M. l, q' g0 j
for(var i=0; i<amount; i++){
* |) `: I/ D4 Q. a3 `, ?8 h) g8 Dif (ADBanners.place == aPlace && ADBanners.type == aType){8 _+ o3 J0 I2 A; d. n
if (usedList != i){: y* b+ o% s# T5 ?% w
  includeList[j] = i;
5 a  C3 K% |* }: ?      j++;. o7 |& U% e$ I5 [1 T. |
          sum = sum + ADBanners.weight;- L% l* Y6 w- F  {  q( ]
    }
  n6 R: g. |7 m. L  }
: Q& m( N% U! D: T7 b}
3 ^  C' D6 d4 W7 s4 O9 Y/ r    if (sum <= 0)
: Z+ X6 U2 O+ L/ U# G- D  return;
6 k0 N' G( e+ y0 R; y) w: B" d    var rndNum = Math.round(Math.random() * sum);
: }& ^* _. w! J
/ W: u" Q+ G0 `" q* Z    i = 0;
3 }6 H/ G: r* ]2 h2 y8 V7 _/ V    j = 0;7 c6 U. H# x' U3 K
    while (true) {
: U1 b8 u* ^4 Q! J      j = j + ADBanners[includeList].weight;
/ k* G& i; f' a      if (j >= rndNum)* g( r0 ?1 r" k- o
        break;" k/ l  F, P0 U+ y( M0 v
      i++;
0 U1 R4 e! ]+ p; C0 y8 D    }: I( k1 p* V6 c' o# y; M) }: U

) _' x6 g. s/ J/ W    i = includeList;/ f: J: a* V; G) T7 _# l1 w1 m# O  K
  }2 c6 S/ B$ B  V2 M( F8 m
  else{
' u% ~2 m1 ~5 q6 `0 @' Jif (aBannerID >= 0 && aBannerID < amount)/ @9 F3 W2 d2 l) y
      i = aBannerID;$ E, h$ V) k9 M9 J- \0 |
else' b/ p2 i7 m! Z* E) `
  return;
1 D. j5 }9 I- _9 W6 d7 {5 P  }
; Y) D, G2 v. b6 N& h" {( ]
+ y+ N2 [- i; \- R, Z3 ~+ K  usedList = i;/ J0 o' @* u! @# u8 T& K
. T  Q) _% v) M5 G) w6 p
  if (ADBanners.htmlcode == "")$ k( u* e, R' q; q* L  ^2 P
    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>');
) D) w) N$ \5 Q2 G8 j& F( i" ?  else
8 {) d* {, W' ?    document.write(ADBanners.htmlcode);
! f* N+ ]8 r, g  y, j}
: }: p7 f* T/ g4 ]5 E, }% S
* O1 ~8 S7 N/ ?( kvar ADBanners = new Array();% _" d9 F4 z! _6 U3 f2 K
/ |+ e! ^- E, z: A, s" l* R
CreatBanners(ADBanners, 1);# P% Q+ t0 w: J3 C( }  Y
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="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';, N/ S) A7 \4 e# _7 w; u
ADBanners[0].weight    = 20;( Y' J! J/ P# J2 |; }+ [
ADBanners[0].place= 6;
3 X: f$ V( g. N( I! U/ bADBanners[0].type = 6;/ A6 C/ ]) x" u: t, a/ j! @. n

9 F2 x2 \3 l1 y$ y7 I* L9 f, C; o, h
  }7 `$ h8 n3 A( R5 F( X4 @
& [! G6 _- h: w. f7 L1 r2 C
: ]9 x6 v' g. v- A# a( {  \; ^* J0 R& P. [# W

" X9 J3 n; X8 H4 [' O此代碼當中CreatBanners(ADBanners, 1); 這裡的數字設置廣告數量,如果只放一個GOOGLE就設置1了.,
1 u/ |9 i0 Q2 V7 z7 F% K0 y- U5 r# I# }$ S0 S* z, d
ADBanners[0].htmlcode  =  這裡裡面填寫GOOGLE AD的廣告代碼,請注意,必須寫成一行0 ^) X, z% P1 r  [: x6 ~/ H. Y
2 m* G% D+ K, U: n* o, i$ Z
ADBanners[0].place= 6;
8 `& ?# I9 e( Z5 f$ WADBanners[0].type = 6;  要調用的序號,具體偶不清楚,哈哈3 s  K- v; _2 h: U) d

. L( {6 n/ Z/ e6 A% f2 g6 B& B弄好後,在網頁HEAD中插入
$ e" R6 C5 g& t7 ]3 f<script language="JavaScript" src="adbanner.js"></script>
2 J: N( Q$ M1 v- t% }! N& W; M! G& K1 I7 D
在要放廣告的地方插入1 t1 M* u, F: V! U, M! C- i& D
<SCRIPT language=JavaScript>showbanner(6,6);</SCRIPT>
' j! R- S! P# p) S9 S6 t
5 m" v! ]# B' y1 t- B2 t這裡的數字是和 ADBANNER裡的數字對應的,; [7 E' H$ ~( v5 j8 Q

, O6 B- ~" Q, t/ P9 _; L; ], k  i. S0 o" E2 s$ J. W& f  e" l  q2 `
<img src="../images/emptylogo.gif" border="0">
6 j0 R3 z. e- T$ a* B) {6 G4 U
% q' [" _/ S% n) p8 P0 _                                                                         ……完……
發表於 2005-3-15 11:20:04 | 顯示全部樓層
不懂,但收藏,努力學習中
回復 给力 爆菊

使用道具 舉報

發表於 2005-3-15 12:05:40 | 顯示全部樓層
請教看得懂的高手,以下Code是設置什麼:- a) G* N+ G; O
ADBanners[0].weight= 20;2 K% e' o' O7 B: j0 \+ Z! y
ADBanners[0].place= 6;% M+ G+ e+ n; }+ _9 ]) x
ADBanners[0].type = 6;
回復 给力 爆菊

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 免费注册

本版積分規則

过期高净值品牌域名预定抢注

點基跨境 數位編輯創業論壇

GMT+8, 2025-4-13 01:28

By DZ X3.5

小黑屋

快速回復 返回頂部 返回列表