返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 r" w% b4 x. E4 v
var marqueewidth=300, O7 S4 v8 V! B- j* }6 _& M
//高度
! n6 [& Z9 z$ q$ gvar marqueeheight=25
3 z9 p5 l6 T; r. j# f1 {//速度(1-10)
0 K, X9 S( q3 V2 {% q' M& Rvar marqueespeed=3
+ \; ~8 [2 G* X. ?//背景颜色9 @' k4 c* U7 t& g5 {
var marqueebgcolor="#FFFFFF"" Z, ^2 W3 a+ N) [9 x* M- b- w
//是否能暂停 (0=no. 1=yes)?
0 ^' K1 n, i. D2 ]var pauseit=1
7 e, E4 B# Y% V) {7 B
. A4 t$ I1 x( A$ V: \; N8 G, W//修改显示内容6 {: i  a! g3 n& c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( {8 Z1 L0 \$ k+ B8 P: V
9 @; l$ {1 t$ e6 H
1 u) s% W0 |- |/ u$ |/ C; c$ r- p) Q
////下面不需改变////////////
6 B. c3 K2 u% F( @+ i: r$ K1 C3 [! z2 Q1 n* D  x7 ^: H# X, `
var copyspeed=marqueespeed
% A; E3 s, w8 d' ]# R" F; t7 @var pausespeed=(pauseit==0)? copyspeed: 0
" B  h7 O4 k  B+ i/ Qvar iedom=document.all||document.getElementById2 O) v3 r* R# r
if (iedom)
  [9 n* j( D# L+ o5 V) I/ r( Y2 Q/ Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" j+ ~: h# s8 j, l
var actualwidth=''
$ d0 b: K8 `7 M' Z5 ]' P3 kvar cross_marquee, ns_marquee- w$ M* ^% }6 z2 b  H5 n

% ~& H' o$ A3 }6 C) f2 Ufunction populate(){1 T) T9 {+ Y6 N' `5 d2 M' s
if (iedom){
! |, g( R6 @7 E1 Y5 n7 }* {, kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 x, W% W/ ]  D- y: C: c
cross_marquee.style.left=marqueewidth+8
$ X" s4 ]* \. V; pcross_marquee.innerHTML=marqueecontent
3 P6 k5 _: e7 C+ r. Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- y9 b1 \  X+ S}% @. Y1 M2 q8 Y. A
else if (document.layers){
8 a' j7 c4 e: k6 s7 Fns_marquee=document.ns_marquee.document.ns_marquee2) [5 ?% Z( g) j/ G2 [# {' A2 M
ns_marquee.left=marqueewidth+8
8 @6 S! H5 A7 ]" U6 O4 o( |% |ns_marquee.document.write(marqueecontent)3 H$ O2 G. P  c5 \' ~
ns_marquee.document.close()' ?, N! ?) `, y4 d; X
actualwidth=ns_marquee.document.width
1 r# k5 n" M# P3 g}
$ c) C3 g: ]0 |6 ^lefttime=setInterval("scrollmarquee()",20): \3 |* h# d& [! S
}9 v% t% ^2 u2 G/ A$ }% }8 W
window.onload=populate1 S4 e$ v9 c, F9 Y

; F. l" ?# \  jfunction scrollmarquee(){' G, W, r4 X* }: {
if (iedom){
5 e' w* T9 A" [: e: Q2 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 m0 P! K  n* v: G% N" ^* bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" M1 r4 g5 {% ?
else
" S/ ]3 w  [  j; t& l( tcross_marquee.style.left=marqueewidth+8# w8 f; ^. ]; _9 d& q; K2 @! Y
$ U% b# L3 \  ?$ D
}; Y7 e  J2 h/ C  F" U4 Z( q- ]
else if (document.layers){/ Z7 ~8 N1 [, J  Z6 ^; v8 e
if (ns_marquee.left>(actualwidth*(-1)+8))
. l" [7 D6 Y5 f* [ns_marquee.left-=copyspeed
, m9 s: F7 ^5 y& d: f0 eelse
9 b3 o1 _% F0 L7 `ns_marquee.left=marqueewidth+8- C; T4 [1 F  @: {0 s. C
}3 j: V  j5 D) e$ s* S
}( i4 C3 H5 {7 s' c( b% e1 E

7 P! ~+ S7 A* V7 }' Z- l3 hif (iedom||document.layers){& a% c3 x1 i, k
with (document){
( q- S; a) Q, Q5 V3 l( l' p6 [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ]& x6 m) p7 b. V" o% H
if (iedom){- }1 X: B, X. z+ _* ]  U5 Z7 \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). J( `6 D( z' E2 F' a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): F; Q0 k* k1 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). s! H7 Z' `2 @  U. c% z; e
write('</div>')/ a5 U& u# d, I; o. I# L
}
+ i4 H2 L$ e  I2 m8 n/ r7 lelse if (document.layers){+ M+ U6 C" S. A: V0 n2 }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 v1 |7 V( x# P+ n, C! @' Y8 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 {. R1 r/ ~) m9 F, G1 C: Jwrite('</ilayer>')
- J4 x9 \+ g! e9 U8 q; ?- u0 d}* ?1 c" S# U& c: o9 r9 }
document.write('</td></table>')
7 [6 F) f+ K, e}$ v$ d6 t* d- z) y3 j% X
}
* i5 e" a* p* ]/ o8 ~- Q</script>

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