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

|
网页之跑马灯文字特效
//修改宽度) N1 G6 H! L! }% O" e
var marqueewidth=300
+ i' H6 w" A. D9 y" ?9 j//高度# d V3 W( o6 |% _ H
var marqueeheight=250 M9 N( V- L* ~3 Z
//速度(1-10)
, N! W* b6 r! o) F4 H2 D. rvar marqueespeed=39 K3 v/ N9 f* l+ s1 G
//背景颜色
; O/ }6 C1 W" n5 _6 Y+ j& nvar marqueebgcolor="#FFFFFF"+ U! @0 ]6 ^' H0 w& {! ~: D. i
//是否能暂停 (0=no. 1=yes)?
) |* k0 g; c% I6 C* g6 ovar pauseit=1 U0 X1 H% c d" y, ^
+ |7 W4 }; R% w+ K7 R' Q3 b//修改显示内容
8 C$ ^0 l. K4 r0 v: _; svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# }9 L; r& S( j* [8 o" b. ]/ v' C1 L k! B
" m3 S- n( F: J# T. `% ?////下面不需改变////////////7 B" p4 ^; ~& W/ j
: B. v- A$ ~# d' V! Lvar copyspeed=marqueespeed. e4 Q5 m$ Z4 `' T1 b7 T! i. C
var pausespeed=(pauseit==0)? copyspeed: 0
/ T- I. L6 R8 d; ivar iedom=document.all||document.getElementById6 } P3 w& A4 g
if (iedom)
" t. G# H. m) ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# z) I) h; U7 ] I
var actualwidth=''( O m, e5 c6 @# u) D8 x
var cross_marquee, ns_marquee9 L7 M- w3 N) D, l
9 i$ E r. T7 A9 m' z) K" H) {& U, ?) x
function populate(){1 ?* D% u) a$ s
if (iedom){- p8 Y/ E" S4 `- U% y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" E7 C9 h. @& m" M4 M5 m2 _
cross_marquee.style.left=marqueewidth+8/ @3 ~1 I% f" J
cross_marquee.innerHTML=marqueecontent0 W1 ~1 T. p0 @$ h0 J. e. }0 x8 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- u( b; D4 P* {( w}9 g; N. a+ e: {/ l2 p
else if (document.layers){
/ l: p) S4 |" z1 T) `8 w! dns_marquee=document.ns_marquee.document.ns_marquee2; P( y5 E( I1 d+ f) O
ns_marquee.left=marqueewidth+80 p5 y. m/ |% N- k9 C" l ~
ns_marquee.document.write(marqueecontent)
, ]4 |4 U4 m3 o# {, x% a0 `7 xns_marquee.document.close(). W( \0 Z& a4 B" A
actualwidth=ns_marquee.document.width* l* z3 ?1 V% w- B4 D
}
* V9 p3 F" V1 }lefttime=setInterval("scrollmarquee()",20)
" ?7 K! o. B4 {0 z}
9 V8 i Y* }1 J; Uwindow.onload=populate
8 a# c6 u; Y8 `5 C3 r) P8 Q1 h8 }' w. a5 z. K9 o
function scrollmarquee(){5 m+ {; a6 h) O: M" U
if (iedom){. H" _$ f/ A7 N. Q3 ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ S( H: l1 a# _* |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 D5 K- K2 M/ \0 Melse# {9 v: P& r2 X4 a. [' F1 c
cross_marquee.style.left=marqueewidth+88 q6 `9 b" O* @) a5 D! @
; e p' P9 O9 r: t) w) g1 t
}
/ c! I" }0 _# v8 I% Q! f7 G; Aelse if (document.layers){
! b# m- U) l& i* |if (ns_marquee.left>(actualwidth*(-1)+8))( ]) B3 ]' b6 B p7 X7 x! D& S* a
ns_marquee.left-=copyspeed
3 U" s( L3 d; g' d; belse! E8 X" R. Q: @5 L3 ^
ns_marquee.left=marqueewidth+8+ o0 W1 K8 T& x
}9 ]: x, l6 L7 h0 [1 A
}
2 o! \' B! o Z4 C8 O
t5 Q+ a4 y& G& v( f: H5 Fif (iedom||document.layers){
( b: k+ d9 y' s- U5 m/ {& a+ t3 S* iwith (document){. f* }) g& y' w& F% h" `& _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 f$ Y! ]1 b, K8 H
if (iedom){3 [9 y. @3 {' t9 T: ~8 z! ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: {9 v! r* d' p. f. a2 Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( x( M4 E7 T, n8 a5 t) u! x- Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! n u# f) t4 f4 N
write('</div>')/ W7 c5 K u- m+ H1 Q2 d, f
}
' B0 b7 w" @* r5 e( Ielse if (document.layers){
5 A& }$ V& t, X9 bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. T# D' E j( D9 D! R9 I3 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' J' ?8 P. U2 M; D9 v
write('</ilayer>')
# A9 E. I9 O' E: }}+ T0 v0 l. h' M2 N
document.write('</td></table>')
# Y* a: ~7 u5 H& b, f( z/ |}
: I# ?% \; X u6 n1 H4 D! _}' a3 V) z# D- {& s1 f. z# u$ M. X( O9 w
</script> |
|