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

|
网页之跑马灯文字特效
//修改宽度: A9 I5 _. l/ L, z
var marqueewidth=3007 j6 O" d6 f% I" e1 @1 r
//高度7 J( U: E9 x6 ~& \( _6 U! z
var marqueeheight=25# O1 A) l) k% N2 ?& j' {
//速度(1-10)
$ l: }- N1 p( ^2 [8 T1 g2 |var marqueespeed=3
, O6 S. B( L. }7 J- o6 Y9 @//背景颜色
% o) n& v7 G2 u9 i" h$ Gvar marqueebgcolor="#FFFFFF"
( w' ` m4 u; u. X) ^" U//是否能暂停 (0=no. 1=yes)?8 s9 `: a' u! D
var pauseit=1
) @# X5 u! Z. I( S, x& [6 e. ?1 }0 g9 _2 A
//修改显示内容4 E, R1 g( Y( d$ P; [" V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. |- M1 `5 L/ ^
( v+ l3 e0 H. G) ?6 ~" Q
( k! C% g1 E% S% h3 Y
////下面不需改变////////////) V- t$ H1 E2 H8 i% K% @
% U2 g9 J) _8 N, {. F7 H! u
var copyspeed=marqueespeed: K' y% O- s* F! z; ?' C8 u. M. K; s
var pausespeed=(pauseit==0)? copyspeed: 0
. B: l" m2 X! F, v6 gvar iedom=document.all||document.getElementById* {5 D+ b, W) r2 Z, j- d
if (iedom)
+ T% |1 l$ K" F% m7 i& C$ C% n' \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ w# T' e7 F7 l6 L5 bvar actualwidth=''
: t! j) F0 }; {. O5 g0 A% z Kvar cross_marquee, ns_marquee
( A1 s# G' s, |* T) V6 y$ I. R+ W. w6 p
function populate(){, N/ D+ J3 o3 ^/ d/ b6 `/ G" A; t7 ^
if (iedom){
% k! a7 q0 @5 y/ ]9 ~% M: ~7 H5 ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 V; D$ z! d% Z/ I
cross_marquee.style.left=marqueewidth+8
' \; C- @! }; V7 V0 lcross_marquee.innerHTML=marqueecontent V5 l9 W" O" f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 Z2 d- Q8 B+ p; U3 ~6 N- N& D}
. ^ d, c9 _& z) i$ M' _else if (document.layers){
2 c6 i3 I: [; m* E1 ens_marquee=document.ns_marquee.document.ns_marquee2
" S3 D- P. y4 s0 c; L3 K& h* Y2 vns_marquee.left=marqueewidth+8
4 s8 R3 `, V. x/ L7 h1 f* cns_marquee.document.write(marqueecontent)4 \( E8 J0 N9 K0 a3 ^! X
ns_marquee.document.close()0 M8 k" ]$ P. @& r
actualwidth=ns_marquee.document.width5 v, N' ~& M! t6 z- r6 ]
}2 j2 Z! {( V6 _8 u. c; I
lefttime=setInterval("scrollmarquee()",20). j9 ]) d# ]% M
}9 T9 H/ m4 ]- P! B6 J* t
window.onload=populate
. A2 e! c9 Q6 [ _4 N0 _' [1 y# r7 A# _; i/ G" I
function scrollmarquee(){, |( x) H, ^- F% `* b6 \( v3 g
if (iedom){, v7 I( p" H7 Q. G& a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) }) c7 w. h' g9 |, P$ n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 N& y+ T" T7 \5 S4 n+ j, g( Qelse5 Q' S' X& ]) F8 q" t' C
cross_marquee.style.left=marqueewidth+8
% ^( [, |' D/ k" Y) ~
) k- a& ?$ T) i. w) L}0 h; k# _$ \, O X0 I7 p9 u
else if (document.layers){
B2 I4 m& k. x' E2 eif (ns_marquee.left>(actualwidth*(-1)+8))
7 c; b9 ~* `+ e8 O7 J) Z& H/ tns_marquee.left-=copyspeed5 x/ T& V) w$ p; I( N$ U
else, |7 r" k+ z( ^% s, s$ ~
ns_marquee.left=marqueewidth+8% |, I7 D L* l3 T+ E* y2 F
}
; q- Y; X* Q3 A i1 R}; A) V; H! Z& p O" O
* o- _7 m3 [& M' p, H! n9 f. w, Y- a
if (iedom||document.layers){8 u2 C4 k1 T H: P) B- p. M
with (document){3 \. Z: [, g8 d/ c. q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ H& D5 A; p: r+ Sif (iedom){4 |9 Q! f$ T" R Z3 s0 Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' {1 a9 B/ K% X# h O8 k/ Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* |9 P' F5 ^! h; B$ t( U: l6 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# n7 X* P3 g C- v# Y3 C' v. _write('</div>')
4 s, |$ q; i0 P( K J: Y}: J$ H' ^" z7 c0 D. |
else if (document.layers){4 b- `+ C. M; s5 |- O1 ~2 O5 G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 z0 x& U5 x) ~) {$ m1 s! T: D- S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- v& X7 K7 X3 e! r Z
write('</ilayer>')+ k: z: d D; N5 d. v( D x
}
0 d: z/ }1 M9 o6 x8 C2 Xdocument.write('</td></table>')
2 P* ^6 P0 {7 @5 t}2 ]- n* n' B( ~! e T9 I/ U
}& t' x8 ~9 N& v( g4 G2 a) }% i
</script> |
|