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

|
网页之跑马灯文字特效
//修改宽度9 m5 C4 R0 K. h6 ~8 q
var marqueewidth=300; U) H2 Z6 K# E- ]) ~7 [2 r
//高度
. |. ]$ g/ F' v1 Qvar marqueeheight=252 i6 @9 T/ L, V- ?: Q4 _4 h! H& j
//速度(1-10)3 r( j2 }1 u, O" h
var marqueespeed=3
) t. s+ z( @$ o//背景颜色
" x/ W6 J+ u* V' a/ Gvar marqueebgcolor="#FFFFFF"- k3 [6 F+ J4 j: J; V6 e( }" t
//是否能暂停 (0=no. 1=yes)?
/ d @/ V& y/ B! ^$ Rvar pauseit=1
' J! Z1 O# W0 y- k( x5 H* R/ s" e c v4 Y3 s% z# a
//修改显示内容
' p+ _, D! a! |7 x2 H1 [: cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* R" b$ t6 l# |1 u7 ^6 v$ n
5 A1 i3 L5 m" M- c+ [
5 h; i. Q2 ]2 u' @% A4 x5 \////下面不需改变////////////' c! H0 {2 \$ p- F
" Z6 F# j" b: r v \var copyspeed=marqueespeed4 g2 D3 k5 e# s( A; D7 P: n
var pausespeed=(pauseit==0)? copyspeed: 0
; s+ u5 k4 n+ `7 B o) _6 Fvar iedom=document.all||document.getElementById
& h, U4 R3 n* G3 N* pif (iedom)
6 K6 K' _% [, M( I6 L( kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 h4 y8 z' |3 ?5 z$ @& m# A
var actualwidth=''
7 t+ m) u9 n9 ]5 Cvar cross_marquee, ns_marquee& [0 J# k7 T$ W/ U% }" M3 G
# z* O# y; h; B) e' `- Rfunction populate(){- z- \* [, _" U7 {1 N
if (iedom){
5 k9 x& ^+ t8 u3 p- j' A* ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 \) y- J1 o6 t+ F' w: e2 ocross_marquee.style.left=marqueewidth+8
$ T; n6 F: k0 G& C8 gcross_marquee.innerHTML=marqueecontent! d0 J6 L1 e% F. L0 H6 o Y2 N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 I# I F/ f8 m}
8 q: Z+ C! K' G* Celse if (document.layers){
& D6 L* l/ l6 m# ]! a4 sns_marquee=document.ns_marquee.document.ns_marquee2
4 M2 R6 I) l1 `3 o+ ~* R" _ns_marquee.left=marqueewidth+8
4 @5 A( Y. m6 E* h( V2 p: _5 n8 ins_marquee.document.write(marqueecontent), d; d( J% ^. u: Z/ d- G! j/ N
ns_marquee.document.close()
& W: o$ h+ Q1 [$ u! R4 H4 X! aactualwidth=ns_marquee.document.width+ w5 O7 c) V( Z9 y5 f1 T6 k& @
}
" J& W) L$ ]7 @9 Klefttime=setInterval("scrollmarquee()",20)
! r) H! |/ i* h O% o}! `& v0 X+ H8 A6 l, w& T. Y
window.onload=populate
% y. R* v" B8 h; ]! M' J0 @ z7 P( y" \' ^% `/ P" o0 e
function scrollmarquee(){$ t+ K, h! p, h
if (iedom){/ o% _; y& ]( u( Y. p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' c [5 c) `0 r! y R( \" ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 c9 T5 _5 I2 `4 Ielse, O1 y' T$ a5 ]8 Z) y S% U
cross_marquee.style.left=marqueewidth+8
8 `6 Y ` ]4 }* C8 p( o
. m, p/ ^3 W( f; U4 W}
+ l4 R N3 T+ l6 r& `else if (document.layers){2 U6 T& J- S/ Q
if (ns_marquee.left>(actualwidth*(-1)+8))
7 q$ m4 t* R$ F; ons_marquee.left-=copyspeed6 g& B6 M8 _6 J! ?8 f6 ^: G6 {: ?9 d W
else1 _: M* B. b; s
ns_marquee.left=marqueewidth+8& i! O0 ~+ |* [, J4 O' _
}8 c% g* Y4 _! O
}
! i% T6 `5 Z. W N- F" J: U5 S
, R) C; u& m# Z4 L2 G% `3 I& Eif (iedom||document.layers){
: [9 Q9 h- K! [ Cwith (document){' w2 x& f3 y0 [+ ?" k- E7 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; S3 s! @6 H& |& x C) f* fif (iedom){3 Q+ L, ~4 B) M! [+ |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% L1 k7 z5 o& I9 u" C& ?0 K) xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& g% g H6 G g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 A( D9 ^0 \* J& i2 P& g; owrite('</div>')
" |2 T/ X( | J$ i+ h}( A; W' U2 Q+ Z/ X& I/ \) U
else if (document.layers){
+ ^( A0 Q0 G- H: ]5 B4 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 D0 O& A, H: T% v0 K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 l* U `+ l6 u8 i u* p5 _write('</ilayer>')/ [1 R8 K) F5 A2 O! j/ q
}5 L( Z; C4 C9 e# f* m; w+ T: E# C
document.write('</td></table>')
( g) d3 F0 ]: n1 X' _: o Q5 D; @+ V}- n) s, ]( U* L: c0 ~/ S. q
}
( u3 D u+ t: J& Z</script> |
|