|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度/ n9 V! q% m! g% O" m- v
var marqueewidth=3002 k- [" o, c# i* b* F9 S O, b, h
//高度
' M% [) r8 J8 R2 f3 k+ ~var marqueeheight=25/ J& W: |/ E# `- M; m! s
//速度(1-10)
+ C; k" q1 R$ }" t N* u% U2 b* dvar marqueespeed=33 d i! u+ t& a2 E! i$ _: M
//背景颜色) z5 D8 u' f/ A
var marqueebgcolor="#FFFFFF": }/ B4 F; l4 `+ R; M1 z
//是否能暂停 (0=no. 1=yes)?
: z1 d% d1 W, r1 z* }+ l0 |' Nvar pauseit=1
1 C& S2 [! r/ {- B
# r9 o! ?( c& h: z# ^' w- q+ F/ g//修改显示内容/ x3 S) U. D) U ?' W! [* c7 M8 t$ L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 L, g2 W; J/ Y4 R# Q8 f0 t2 P. @/ K! V* S$ B; `6 X' x
- L! H; V# b# j
////下面不需改变////////////; [( G2 }8 U4 {- w0 h: F" g
; c7 l# u0 J1 i& f4 D3 F
var copyspeed=marqueespeed- h" K$ n! Y( P
var pausespeed=(pauseit==0)? copyspeed: 0. i3 i+ U/ s! j' ]( R0 O
var iedom=document.all||document.getElementById
/ U7 c& T: {2 P1 h% cif (iedom)! r2 u! n: c [# }3 W4 w2 F. j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& d5 }1 o _2 o7 f/ |4 J- A6 Evar actualwidth=''+ t" f6 M* s- h, V$ P
var cross_marquee, ns_marquee/ \0 I m$ [' k( r5 b& r* I
, H. K$ N" }; ~function populate(){1 M4 g9 W1 v6 Q" z% n* K8 b+ l
if (iedom){
" [% m' P# o+ B& i0 c( j; gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, v. E7 c: ?! s! f+ d4 a d) scross_marquee.style.left=marqueewidth+8
: f3 O+ U: X. s- i: Vcross_marquee.innerHTML=marqueecontent" `9 I5 |) p( P5 T0 `; n7 W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; @% N7 o4 M8 R: M8 L& o I
}' p! W; Y$ w- P- b0 k
else if (document.layers){: b/ _/ ~; ^ I! ?: C# a
ns_marquee=document.ns_marquee.document.ns_marquee2
z7 U: V) j% i/ ~" ons_marquee.left=marqueewidth+8
) C! U1 S2 `3 T& g% I# Sns_marquee.document.write(marqueecontent)% o* b: w) l# Z6 O
ns_marquee.document.close()
, _3 b& S5 B5 K! @actualwidth=ns_marquee.document.width0 {* j. N6 L8 V! b0 f: I+ i4 D
}
+ U/ T/ r% \3 F5 Y# H; C, V+ D' qlefttime=setInterval("scrollmarquee()",20)5 R4 Y4 A* B/ n+ ?. g
}
2 r* A: z6 O/ zwindow.onload=populate
0 u0 O$ p, Y. b" l& X
3 m9 ?" G; _: p: _0 xfunction scrollmarquee(){- X4 `: M0 @$ W" @5 {+ n
if (iedom){. X- [8 r' g. w I) C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) B6 A1 P1 x: G! g8 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 d' D8 d D4 q9 e% X7 B
else8 \2 x2 W1 w2 y! b6 ?3 E7 {
cross_marquee.style.left=marqueewidth+8
; ]9 m4 k& K) c' q L. U& |) ~- P7 `7 D% m* P1 s* V% j2 X
}
|3 `# W+ {, g9 y4 f3 b2 melse if (document.layers){
* E$ r, [' a0 Xif (ns_marquee.left>(actualwidth*(-1)+8))
# V4 l: u. e1 b9 r5 I) `* w1 D- P2 ~ns_marquee.left-=copyspeed
1 W/ y# Q9 [( _4 G0 q3 E$ m# uelse
) Y0 s: t6 g* r5 T/ w1 m+ ^ns_marquee.left=marqueewidth+8
7 ^6 n z0 C _3 \8 k}0 e x# r8 I7 m) G2 F5 P% F. U
}* |5 Z( X0 j* v- M8 q" O" S
; G8 y1 K6 X; ` D" E
if (iedom||document.layers){& m; R' I8 r7 x. `
with (document){7 V2 p3 p3 B+ o; O: N9 }+ `9 @6 Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' z- _2 p/ D* D5 g- P" {* j. I6 s
if (iedom){7 n; Y1 e$ }% [/ d+ R6 G1 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 ^/ J$ a0 D1 a6 {! Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& g6 [4 J2 P" u: ?* Q) |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 v3 A: k S- e8 S5 Q, r. V, D
write('</div>')- U5 q- D! J4 b7 z6 |
}
& K4 X9 M) \- m4 }else if (document.layers){
+ x( z& j% ?& \: k) @* Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' J$ r1 C( z3 Z) x, o4 J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 _- @- j6 W% p$ v! owrite('</ilayer>')* I g7 }2 U! W7 w
}5 ]9 c+ l0 z9 c# h" G0 S" I- O& g
document.write('</td></table>')
7 \1 \5 y$ c' N1 y}
/ S- i/ N% S2 |& M! C I; x' d}
; X0 M/ ]/ ^1 x5 O; b& M* E</script> |
|