Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度) ]3 i" v6 s) q$ [0 a
var marqueewidth=300
, a* F, ]& w  ]" P//高度
" s' s4 e  Q9 a3 Q# D: Z) ?var marqueeheight=25/ g( T' c! O* L2 V
//速度(1-10)3 g) J( {6 t- E
var marqueespeed=3
& a' i/ C& x5 J- ~1 r//背景颜色) `, m/ Y; C* p2 L
var marqueebgcolor="#FFFFFF"
4 t7 Q' x7 v6 W' R& }//是否能暂停 (0=no. 1=yes)?
8 [8 i4 p! b1 `0 L: s, i7 tvar pauseit=1
2 O# O- A8 s! ]# E  p! G' X
4 k7 [$ a9 D; w6 e$ a//修改显示内容/ v& J' `3 c9 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# s- [# |& P9 K/ r& I
: L8 V( L& O3 E
" j1 \0 J/ {( g" q  `% |////下面不需改变////////////; d. K! s8 z3 a/ }) @
7 O$ y2 f& Z2 U8 m5 n% D, N, X
var copyspeed=marqueespeed* t1 s4 F# A2 }5 D9 n( R
var pausespeed=(pauseit==0)? copyspeed: 02 ]* h/ _7 M: ~' t; i
var iedom=document.all||document.getElementById) D# w' Z3 ^8 Z/ v
if (iedom)
( V. y$ A; U# J8 J- N/ ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  `2 \6 C  s4 ^5 K) B; z
var actualwidth=''# x  j& N0 Q/ J4 ~- s
var cross_marquee, ns_marquee
- l) i( p( E- j4 Z+ G5 b- m( O$ S! j* G* z/ ~
function populate(){
" a8 Q6 l9 M! `" n6 mif (iedom){+ v+ U3 h9 m! }: Y( P& ~0 w4 M$ f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ z7 U7 W+ ]. L
cross_marquee.style.left=marqueewidth+89 t- ^& U4 g  [! S: ~
cross_marquee.innerHTML=marqueecontent
- D7 N# x2 r- T/ G/ Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 u* V# m7 A0 }9 T! I}
0 @& a8 J& V' q0 _: C+ melse if (document.layers){3 p) ~# n2 o' k" Z+ `1 @
ns_marquee=document.ns_marquee.document.ns_marquee2" ]! k1 H, I$ y0 i! }
ns_marquee.left=marqueewidth+8* l" e8 @5 Z0 z% U$ T0 _
ns_marquee.document.write(marqueecontent)/ U  O1 H) l' m8 s
ns_marquee.document.close()' o4 L+ O- M7 i1 E! k  c: }  A
actualwidth=ns_marquee.document.width$ L3 t  R# Y7 j8 t
}( ], ]0 S6 j+ h- w- F8 Y
lefttime=setInterval("scrollmarquee()",20)7 n4 E! h  a- q' c( e) q
}
3 _2 A6 u# R+ `8 H7 F0 \, {window.onload=populate
8 d5 r* c3 @4 h4 B' t: L/ y7 d2 W' Y1 T6 @5 k$ o! N' S* H2 K" f9 t7 ~
function scrollmarquee(){
& p6 l% A0 j, G& T. Xif (iedom){6 |. a. @5 ?7 P0 N( {7 `8 o5 |) S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ C1 U6 X4 v- |4 g5 {' L7 I' I+ z  Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 p9 S0 J/ N6 r  O7 \else
( S" R" k3 Y& P" K; hcross_marquee.style.left=marqueewidth+8+ S% @; F3 v* h$ p
- t! \- A$ ~% C: u% Y# {3 a
}# P: a5 k" G, d  L: y
else if (document.layers){/ e' _/ @* Z. r( d
if (ns_marquee.left>(actualwidth*(-1)+8))0 u+ @# s' ], h, u% }' ]/ M
ns_marquee.left-=copyspeed
6 m. ~2 T% ^' l9 ^else/ u" ]/ m% n7 `8 A
ns_marquee.left=marqueewidth+8( y$ e- ?0 G; V6 T9 W. _- B& G: T! c
}
! B$ I. ]) P9 U$ K& `5 F}
8 X. w8 t5 F' T% Z8 v# O' y' ~4 z# d$ I1 D2 P( V
if (iedom||document.layers){$ y* J( M8 M) ~9 o2 [7 k6 D- e  w+ B$ a6 j
with (document){
" H4 u8 g. o$ p3 y" Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! @1 s3 f6 }' Q& N$ W( U$ A, W9 t
if (iedom){
0 V4 Y: a* H0 S9 c" J2 ^2 q3 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! a% Y- \$ W7 h) w& u! B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 ^, T/ v  O: q* K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 N  H. @; T; B( N
write('</div>'): W9 y+ v: a( ]* G0 W
}
9 P, n$ d. O, ^8 v9 E4 o$ N' l) I2 g4 Eelse if (document.layers){
6 Q  r# f5 n  vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, }# J  ?3 y! f  Q; x3 nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& r9 ]5 @% L) e% Z  r6 Dwrite('</ilayer>')
, Z. n# C4 ?& q7 ^2 B0 a}
& Z+ |+ ?0 x: m! X! @document.write('</td></table>')
7 m! L2 x2 O9 ~* X( t3 }}
3 H% s# s6 c; u8 F& O7 [}
& l$ k% h: n3 I# ^6 b</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2