返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ M$ B& {5 B; @! v- q
var marqueewidth=300
2 k5 b4 ]; J" d//高度
9 k$ c" O. b9 R7 L2 v6 [var marqueeheight=25# W. R7 P8 t1 V
//速度(1-10)
8 i( c' R8 o/ H0 ^9 E% T7 O) _* fvar marqueespeed=3: M1 P) [( p* w
//背景颜色
/ _7 \$ ?% I, S* I! nvar marqueebgcolor="#FFFFFF"
2 c& S, S3 d" y, T& B1 u  R# Z2 _//是否能暂停 (0=no. 1=yes)?, i, o+ s6 D% F  u; f
var pauseit=1
9 m8 G$ Z9 K+ l1 `: @! c
( o& Y! X6 @, t# o' o7 B//修改显示内容
$ `4 C; a! Q' Y1 ?+ Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 ?( Q3 g2 X5 l% H# _+ {- P9 q! o

: e  O( f- Y! {2 ]  N3 z0 x: b3 A- [  n% ?  r8 \* l* A$ V
////下面不需改变////////////
. u3 J+ l; n. C; \+ @/ Q9 L% {" n+ \' Y" _
var copyspeed=marqueespeed; v1 R" b+ t5 [% M
var pausespeed=(pauseit==0)? copyspeed: 0; F" V5 T  ?& l: Q3 X* `% T! W
var iedom=document.all||document.getElementById
- p& o5 t3 j' l- Y( P, tif (iedom)
7 s& b7 T5 @' }6 M2 l, ?+ ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% Z' j4 _6 q% ?/ c: x
var actualwidth=''
& L8 \7 G; a' T' {: z  \var cross_marquee, ns_marquee2 e9 L4 x7 v( R3 r% r" j
; L: e. H! Z& A% d- ]
function populate(){
( Q2 I* C- H6 c8 B" z* |( r7 \if (iedom){: e8 V& b0 s3 W  P# |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ |4 C: W8 v4 {2 F8 ]' M2 Fcross_marquee.style.left=marqueewidth+8
! a% n7 `6 N4 x1 zcross_marquee.innerHTML=marqueecontent
/ x/ O( s- }3 r! e( e! y  A& D( Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( `9 y' G4 A, `* J/ d, S}: a: H, X4 s( A) U: _
else if (document.layers){0 v/ ~2 h4 e  j8 c) K7 |
ns_marquee=document.ns_marquee.document.ns_marquee2
3 D0 {- b0 {% S) P# ?1 ans_marquee.left=marqueewidth+8
+ q; |4 ?# b' {- M- f4 zns_marquee.document.write(marqueecontent)
- ]  H3 t, j# a: _9 Rns_marquee.document.close()4 ]1 n5 Q( }! y( L7 h/ r; y- F
actualwidth=ns_marquee.document.width
2 y3 j, E% T2 o# q* u}
& o8 r( D& F" S9 [9 x/ a& Hlefttime=setInterval("scrollmarquee()",20)
/ H; I$ y/ V0 X4 l$ |: u- m$ I8 P& _}3 @0 W) M" d# ~* r
window.onload=populate+ v1 H/ W2 O7 Z: e$ [

; G3 c& M0 Y) [+ w* j9 sfunction scrollmarquee(){" ]% p8 g) E( N" U  m: Q
if (iedom){9 d8 F2 B& X: x, q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): ^- Y5 z  f7 l% \% u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" b& s8 L; L3 D+ @7 l- D) D
else% M& H, L! A0 e% z. w1 v8 K
cross_marquee.style.left=marqueewidth+8
9 r- o( b$ O  f$ C/ ?& v5 {
3 b' g) I) j/ K}
. @' a7 v# T$ A, b' qelse if (document.layers){
" e: `- e- v  x2 Z* _: aif (ns_marquee.left>(actualwidth*(-1)+8))1 J5 G1 ?' O8 l% W* {: B/ y! s9 p
ns_marquee.left-=copyspeed
. l6 v" S, W+ @' X9 F# D! Oelse  W+ E+ M* H8 P/ Y
ns_marquee.left=marqueewidth+8) h( Z6 x' X3 g8 t8 T: J3 R6 p
}
4 s3 u' [: ^9 o9 X6 @}6 ^5 @8 J9 J; x1 z+ l

( \  a) x: A% ]2 k6 W. y( K" @if (iedom||document.layers){7 O3 O1 F6 T8 `! [, A
with (document){. B* Q$ X! r$ X. Q+ B! G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 m4 `/ t) Q2 m0 O$ A: cif (iedom){
% y+ O/ s2 ^- g4 j- gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 R& `2 k& }9 R' r2 e' L2 x5 iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! a; l, H7 _/ A' M" R. \$ B+ |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% Z3 I9 \' L9 `
write('</div>')
/ s7 i3 J5 _; h; n}
$ }# w! Z4 a6 ~, X( a; \else if (document.layers){
5 M$ K) ?' T$ O3 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 b7 _# r$ r. ~& l$ {4 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  @" G# h4 Q7 f8 D/ u8 e
write('</ilayer>')
8 m& f0 R: C" l. y5 a) |2 i}: B- y' M* {$ b% w' f, B
document.write('</td></table>')
# P  g" j! P6 ^# ]4 Q. u: G% O}  C9 K6 r& x7 q3 f7 [0 O
}& v: c, ^( s, H( ], V3 r% D
</script>

返回列表
【捌玖网络】已经运行: