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

|
网页之跑马灯文字特效
//修改宽度
( l6 X/ \5 E- n; B2 V2 j2 Cvar marqueewidth=3009 f Y* z% {- _. K1 @4 ]$ h
//高度
" _8 a) {" b o1 t5 U, X9 Bvar marqueeheight=25
5 Y3 T+ E, `$ h* O& U//速度(1-10)
$ G2 ^ B0 \3 V/ K9 v+ d3 P# ]var marqueespeed=3& J' ~: G1 l& @) N0 J" U |
//背景颜色
) I$ L4 h% C, o- O9 b- B- M) ^! G2 ovar marqueebgcolor="#FFFFFF"" ?) Q+ y f$ T6 D) ?
//是否能暂停 (0=no. 1=yes)?
* G; Q/ _ d0 q8 r, H& f; yvar pauseit=17 a! q( Z9 r2 c- R3 E1 d
, S- O6 p- c: X- \- U" j//修改显示内容
% W; y6 K+ S* i" r5 g7 v' ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 D: c' n g* M% q
* P4 n$ X @; s" P0 r1 w# ]5 c) _5 x, j6 u0 U- C$ k! }3 {
////下面不需改变////////////! ?( K3 M- c! D% H6 z. w
+ P7 g3 S( _6 b n5 ]1 ^var copyspeed=marqueespeed
9 b+ Z! ]$ Y6 K" q$ Lvar pausespeed=(pauseit==0)? copyspeed: 0
! a+ D2 _; @/ r2 A* e, Y6 ^+ Tvar iedom=document.all||document.getElementById u3 Q+ \/ A, a; h
if (iedom)
+ ?0 F8 F/ x5 w2 h, j! Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* |6 i- s4 h" D& j8 D S- Jvar actualwidth=''
+ R0 m1 D j c) p: V) X( Bvar cross_marquee, ns_marquee
: T3 I0 k" f% }! R, k) L/ i) }' g1 _$ B3 ]* l: j
function populate(){
9 M% A8 `9 h3 ^. ?$ C/ X Hif (iedom){8 F9 t. ? w6 q' Q# R! @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ f& w# X2 v8 E0 kcross_marquee.style.left=marqueewidth+8
- x6 Y* X, O% X: x; `0 Scross_marquee.innerHTML=marqueecontent( b6 j9 M: S2 W% Z/ ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. G& r& j) o3 b}& h2 @% x9 Q4 j7 t: t& B. X
else if (document.layers){
2 u3 @% V8 ~) k" g( p5 ]3 p& Xns_marquee=document.ns_marquee.document.ns_marquee26 _: j! z. `) Q6 _7 v- p
ns_marquee.left=marqueewidth+8
- n" K* T( G+ N {ns_marquee.document.write(marqueecontent)2 L! V2 a6 \# z* |6 j" c& u
ns_marquee.document.close()
% u+ ?: M4 E, ?5 Cactualwidth=ns_marquee.document.width
7 M$ P6 ?; s* X; _" p$ T}
" s- ^# h9 W6 @* Qlefttime=setInterval("scrollmarquee()",20)+ Y' v9 r: W7 K1 b6 J8 g$ M
}
; [- V+ ^9 H; ^2 X$ rwindow.onload=populate" z* }. S. J5 H. p1 ~# M& d
" A, b+ q i0 R9 |$ Qfunction scrollmarquee(){
4 B0 ^( P, I5 f4 ~; a" l: J/ Eif (iedom){
0 ^( N) C$ M" [6 [( O! mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% J- U' \' E0 u# ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ \: }6 ~/ f9 I. h& melse
, c7 A( i9 W" l6 {cross_marquee.style.left=marqueewidth+83 o. X5 m* ^6 Y! q/ F- o
' g# p- Q7 L- U( r}
+ w8 d2 F+ J" R" j1 `7 C& r3 Q" O0 v" welse if (document.layers){
5 a" |8 {8 s& ?" E+ c/ {# rif (ns_marquee.left>(actualwidth*(-1)+8))9 I( U( v" W/ z2 _
ns_marquee.left-=copyspeed
& g' h, v( c; U5 \; G# i. Helse
. Z2 ^6 M/ |- B" r. ]: [ns_marquee.left=marqueewidth+8
6 }( X! j# |6 m}# u6 s0 P, E% X5 P/ X2 R
}
# ]* |4 |7 b1 x0 e- P0 r$ J& Q/ X3 a$ Y3 `
if (iedom||document.layers){) H3 `/ |% B) z! d7 F: h
with (document){. R* E# j3 T$ X- U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( A$ v' |( i/ ^- d& y2 f
if (iedom){" R7 C6 B7 C" t u) k7 y. ]" w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% n. h* v% O2 X) h9 I& Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" j; v7 V3 U S5 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ [# C1 I) Z6 j. z+ n( iwrite('</div>')
6 m | [3 k: D! C}% G+ h9 S* v& P4 M, |- }
else if (document.layers){" b t$ f P' J! z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' q$ P3 y5 B! K5 a1 M( F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 G O- i, B, t- e3 Vwrite('</ilayer>')
% v0 J) y3 R! E, @, Q. ]; R}! q7 H6 C, C: D, E4 o* q
document.write('</td></table>')
* F7 E. ]" J: ^* h} [" {3 q8 T$ c+ D8 ~! ~
}
% K2 x; n$ d5 e- B</script> |
|