获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 M* t/ T1 t7 _, }0 G' {7 a
var marqueewidth=300
, W3 C8 i. M1 R" H8 c! y//高度5 a9 z; X* T$ n# S, A, h& S
var marqueeheight=25
" Z" s& [5 y$ }//速度(1-10)8 d5 e. K8 k- v; i0 _. N& x
var marqueespeed=3
7 T9 k2 I# J0 _5 P- o( Y3 N* x" }//背景颜色
. Q! Y9 n) O( i6 u. A. g2 Ivar marqueebgcolor="#FFFFFF"% R) {$ @0 I7 [/ Z5 c. B
//是否能暂停 (0=no. 1=yes)?  E3 a3 z/ s5 X  V7 v# K9 c% ~% \
var pauseit=17 ]- R7 Q2 m2 W  ~

; g. b* R3 ~6 r4 Z7 b//修改显示内容
, k0 _5 [' l3 y. w. p$ Q. [# Y/ @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 U- ]  L5 G( S1 [5 m, ]

3 t" D& J# F( n. r2 x6 Y* K. a/ P( V" g
////下面不需改变////////////
9 M/ v( m8 O% b, D7 I
& ?- X% J6 Q2 P3 z  j1 C* jvar copyspeed=marqueespeed
  [9 W3 X, y. x1 o3 D8 @( Cvar pausespeed=(pauseit==0)? copyspeed: 0
0 D& K1 M: y+ f3 e4 S* Q2 Gvar iedom=document.all||document.getElementById
0 q/ A8 x. y) T) wif (iedom)5 L* ?" W5 f  }4 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# _& d) y8 v0 e  r# |* X6 c) c
var actualwidth=''
$ c# H' X8 m$ U; Nvar cross_marquee, ns_marquee* h+ a: [, x. m8 i8 p' b7 z% {* `
/ q  O* o" }4 v. g) _
function populate(){
; l0 C  m9 K" a+ O: G" }7 a- M: Zif (iedom){) M8 s4 k" @: p* X; o7 h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! Q2 g0 q- V) S4 O* ]
cross_marquee.style.left=marqueewidth+8
3 c" V4 @. F. ^8 [* X9 A) a7 Tcross_marquee.innerHTML=marqueecontent
# ]6 }: k) D+ M' o8 ]6 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% ^( n: L& n6 W' @6 o}% L" [( M3 \0 c! X( t1 ^9 U
else if (document.layers){
3 x1 M9 f- y, ?- Vns_marquee=document.ns_marquee.document.ns_marquee2
; X. J0 r! e" R) _  }ns_marquee.left=marqueewidth+82 `8 E! F+ b; G' g% |' `
ns_marquee.document.write(marqueecontent)4 A% Y7 R% g7 P" i/ v: Q
ns_marquee.document.close()
4 M% e/ n7 g% f1 h! c/ G. x" i0 \actualwidth=ns_marquee.document.width" S/ L4 B# }6 G% L" @" i
}( c' I! l, o/ y4 l5 T, \
lefttime=setInterval("scrollmarquee()",20)
1 U: Y$ ]+ h, Z# G1 r- u& X}
! l/ _) S; Q' s% b" Fwindow.onload=populate5 d+ c% [8 \/ E5 O" g; `! T

: ]' e, M7 e- v' Y6 bfunction scrollmarquee(){
5 y+ ?' J+ O' U" m2 ~/ M' S5 _if (iedom){
0 O0 w9 \8 r- t! f6 Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 Z' K( ]; q1 B# \& _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# c% `- R- b  u7 P
else
2 g, ~2 a- A$ T' j" {# R: Bcross_marquee.style.left=marqueewidth+8& F3 G5 A8 `* i9 t; \/ U2 I) f
' h7 `4 O9 s. ^4 d5 Y9 v( |
}
( K6 [. M2 q( ~/ W3 l  ]( v  Relse if (document.layers){
: o) |! E7 w* u+ W# I" }1 O2 W) q2 z  kif (ns_marquee.left>(actualwidth*(-1)+8))
' G. M# W) P& G& {% lns_marquee.left-=copyspeed
# W8 o$ h" f( Yelse  v7 }0 S8 K% ~3 c( C' w
ns_marquee.left=marqueewidth+8
: @; O- @  v% q. [}
/ n: N, W0 T8 k7 F5 C, t  z}; n3 E) `! A1 t+ {0 Q" `8 j

" n  ]7 v! \* |- y% c' Fif (iedom||document.layers){
( d$ i4 y" n: n. P  J6 [with (document){
/ J- T$ P7 N1 a& R: cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 U+ n) x& G  tif (iedom){1 J9 g$ A' |) P" Q+ X$ }5 z1 T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): w) h1 Q$ O8 j7 ]* l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 Q0 r( t; Y- M7 J" o+ mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 b  n) m. ^; ?  Jwrite('</div>')8 u- F. ~3 k8 E' J
}% O: k- s( f$ |3 B& z
else if (document.layers){0 {9 M- E9 z6 `; G: ]3 L0 E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' P/ t- b0 y3 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ A) Q6 z4 O, _1 C. c4 M* `
write('</ilayer>')) h7 P. x0 y8 P8 l9 ]
}" M* l! ~5 U: I! o: O
document.write('</td></table>')
# U8 x* N6 h9 j& r& {7 `}% S" c* r% V6 A( b) s
}; B4 C  k6 J$ Z9 ?
</script>

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