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

|
网页之跑马灯文字特效
//修改宽度
5 Q& G/ {9 V5 k, |( v) Lvar marqueewidth=300
5 p8 V" Z. I" W3 ^) _8 a( v" _//高度4 v" P# n* E6 }6 \" ?" M1 t
var marqueeheight=25
# r0 L# Q1 h4 p+ c' O0 Q t//速度(1-10)) h, n" [/ y r) Z$ T) l
var marqueespeed=3$ C5 _0 B/ }' X: o! l* @2 z
//背景颜色
4 h" N; q4 @9 f, u4 X) n" fvar marqueebgcolor="#FFFFFF", D; R- ]& f+ B4 ]/ T6 n( w3 r$ P
//是否能暂停 (0=no. 1=yes)?0 T4 i- }; o( I# j; J( x
var pauseit=1
$ g1 {1 j( n- v7 l+ ~' y
8 L2 `7 _# M- C7 d6 J7 Y//修改显示内容
1 o( U) D3 n2 W% N3 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# Q( E! t* X' A+ n" ?. A5 W9 ^# U" ]
1 }( _& Q9 j7 [6 i$ g5 ?" b/ |& R0 n! G/ d
////下面不需改变////////////# Q4 [+ C& |& _9 ?
& C6 s$ {* u0 C$ p
var copyspeed=marqueespeed F+ v' V+ z$ `6 Z9 k/ W
var pausespeed=(pauseit==0)? copyspeed: 0# E9 r( v- S% U, r) q. h/ {
var iedom=document.all||document.getElementById5 u' V7 P, Z; U* c
if (iedom)/ g& v) f' f1 A7 w( {& Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
y+ [) `5 W# `: j; Avar actualwidth=''. F* r! a: D4 V$ g+ \5 t
var cross_marquee, ns_marquee8 j) u% A( W) v$ h2 R8 d; ?
$ U& N" _+ N( P2 }" q" x3 Q
function populate(){1 C+ ]2 p. a& @/ A2 R$ l8 X9 E6 g! B
if (iedom){
0 T# u$ M3 W7 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& t* Z5 F% t( {! s# f0 X, [% ycross_marquee.style.left=marqueewidth+8& I, i& y" f/ h( t( f* }- g; e
cross_marquee.innerHTML=marqueecontent9 i/ n; E3 e3 T& f+ ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" g3 X1 T4 I6 a' I" n}
$ F) Q# d2 }7 [% A% T& N3 \else if (document.layers){
1 W/ w/ [/ L" G9 I0 ins_marquee=document.ns_marquee.document.ns_marquee2
( v: w# o$ z* n6 _ns_marquee.left=marqueewidth+8$ s4 f. s3 E7 L8 x, p
ns_marquee.document.write(marqueecontent)
# A) f& ?( n% \/ yns_marquee.document.close()
9 e7 S1 A+ Z0 s8 _actualwidth=ns_marquee.document.width
' X: C& X5 E- _ a2 X3 o. ^}
- \/ Y3 Z+ n, h8 b; elefttime=setInterval("scrollmarquee()",20)
. k9 r4 o$ r9 p2 J x6 y}& ]# K; S% u1 c5 r) \$ P' Q7 Y
window.onload=populate( j3 G2 M, f: }% O
# e( a" U3 [" xfunction scrollmarquee(){
( T. n' { W( e+ B9 ^+ dif (iedom){
; m( [0 ^7 v5 e6 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% y5 q5 J6 c9 U: D1 ^5 [7 mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 F( A9 F# b- b; J) X1 k: H2 X
else
4 I) d2 Z/ n3 c! vcross_marquee.style.left=marqueewidth+8
% O" n2 _$ w: y4 _ s; U( g7 I' e9 l3 O5 O' A' V
}
9 n4 n/ p' ?* ^( Helse if (document.layers){
" p5 D; G1 H' {4 `0 H# uif (ns_marquee.left>(actualwidth*(-1)+8))
5 B) I* Y3 n/ R+ F1 ]! g0 uns_marquee.left-=copyspeed
: M+ d, u, N4 n" [# Ielse) w6 _$ g) t! N7 e5 u+ w
ns_marquee.left=marqueewidth+8) ?" Z* d! D% `8 ^( s
}
) I& R* y3 _* V, [% j& l}7 g% E& D9 u# `7 _6 T
+ p" S7 v" a( e: w0 {/ W. T5 i5 ^
if (iedom||document.layers){2 [0 H1 D( R# F
with (document){( c/ o5 w: D# E# ?3 H2 _7 R# p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); V' n" y* D& L) [
if (iedom){
3 `( x: R G& w8 [ t$ Z5 L; `3 a* Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') o. W5 i: h0 [6 ]4 s; B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 H: |2 q2 c6 V, P3 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 V1 Y, `7 T, g& w* t# Ywrite('</div>')' l' ?( c7 T3 T2 P' z
}
2 L5 s+ j1 t# ], D9 [6 Yelse if (document.layers){
3 M- ]; h& ]9 d) t& c& Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 z3 h' n! K. l- e( t- T& S' _0 f; fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" C$ B# X- E, C* H
write('</ilayer>'): @* s. j) W; {( y+ O
}
( L2 @3 x4 ?8 d u( H0 Hdocument.write('</td></table>')
# R8 E& f) d S}8 q9 g! I( m* M( t0 H4 \
}
5 R2 ~. ?( i! U7 T2 i0 O( q5 O</script> |
|