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

|
网页之跑马灯文字特效
//修改宽度9 R& i/ f) ~" s. A
var marqueewidth=3002 _' p- _4 c& D
//高度
( \: F! x. K) F6 K2 x6 f2 hvar marqueeheight=25& f( O/ l6 U; E7 s% \& \4 m; y% u* S/ ~( ~
//速度(1-10)
0 m U. W: u, \' B* } h- gvar marqueespeed=3% ?2 W- K' _+ P: d
//背景颜色
5 V2 A* K( V% lvar marqueebgcolor="#FFFFFF", P9 F, T7 x4 e- S) R. m2 u
//是否能暂停 (0=no. 1=yes)?8 q) [- R- _, N q
var pauseit=16 D$ F% K; e, q A
' Q9 H; _) j# Z) @& R# \6 M8 p//修改显示内容; y0 L* G: I9 x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': L; e: M" l- B/ B3 d, K C
9 X1 L5 W _7 a' J! K% u& {" U
: U _! f) q9 @: `////下面不需改变////////////
: w. u& V. g4 w" q" t: x
; n% w/ ]4 Y. P: Wvar copyspeed=marqueespeed: w. o: Q+ E' L$ B( f6 C+ }8 Y- w
var pausespeed=(pauseit==0)? copyspeed: 00 c0 j7 o1 n4 C9 f7 e4 j9 W- `+ y( b' m
var iedom=document.all||document.getElementById6 _0 T) r4 D! e( B" s
if (iedom)% ?0 d7 e3 w4 i5 d* m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% K1 B3 C: m( V, ^var actualwidth=''( ?# g/ G/ s: c6 E i0 E
var cross_marquee, ns_marquee' C* W% D" U. `" o4 [( l
- Z0 d1 ~2 E8 Z Q: Y- H* m% F6 U
function populate(){) S$ j$ y& E& o8 i
if (iedom){6 L; V5 q7 ~- Z( @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 m3 A/ L0 s$ V0 Kcross_marquee.style.left=marqueewidth+8
2 d2 @: @+ @3 |: }% g* `3 ~1 Ycross_marquee.innerHTML=marqueecontent
- h# X1 c1 a* O3 dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 n) ^! n' B# ~1 X( |( S" m! \/ E$ W
} L4 l# e: r3 K4 _
else if (document.layers){
, U3 X! h/ Y4 ]- Z% f. o' ?! b: wns_marquee=document.ns_marquee.document.ns_marquee2
% x: ^9 ?& A( t: uns_marquee.left=marqueewidth+8: i8 i. M/ w% I: \
ns_marquee.document.write(marqueecontent)' p- @0 i# z# X3 @6 I. n
ns_marquee.document.close()! ?: q: y% `3 {. ^
actualwidth=ns_marquee.document.width6 r3 E4 R( f9 s; `# |4 h9 |
}( |( u) h( @8 {7 a1 f. \8 F( b" Q! n
lefttime=setInterval("scrollmarquee()",20): U, i. x' }: {6 V4 v
}4 @5 [2 T) v7 N" h& v& X
window.onload=populate V6 V% }( F; ^9 z
% w- R6 z' r/ B& Z' Xfunction scrollmarquee(){2 R- \7 |1 q# s( q9 e) \3 _
if (iedom){4 J; ^, j- b+ D2 O, V* l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 N; s5 C5 L$ s @5 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) J7 ?( w! V/ J" d, \8 {else
. Z ?4 y( _. d a# C" o4 ?cross_marquee.style.left=marqueewidth+8! m- W( c. @$ i4 o1 e0 f' R% b3 \
. L; J5 U( ?$ j# R}
0 g7 k/ E4 e7 G1 F0 uelse if (document.layers){
1 O! ?. z6 u2 I) B' T7 |if (ns_marquee.left>(actualwidth*(-1)+8))2 _1 d& U6 g' R" n* K# H' k
ns_marquee.left-=copyspeed
]3 G2 w4 v6 R7 p' p3 ~else
1 y3 K" ~! o( ` R' C% jns_marquee.left=marqueewidth+8% }% O" |3 b+ q" u
}
- i" V w, a O A}& H# G- \# K% I6 a
& L& @ i& y5 _6 s' U5 }8 `
if (iedom||document.layers){
) j3 }4 u% F5 f* U% v" mwith (document){
% x# e: q# c6 z/ G2 q, S Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ D" K/ ]( q5 Z+ Y1 h& I( ]* u
if (iedom){
1 B/ D& M$ V( ~: f2 H4 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: O0 j) k2 P7 i5 I+ hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ |* Z2 v" \; n) v* }. _8 H6 Q: k/ Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- V# |/ n/ v* m8 r, J
write('</div>')1 X, l: [/ f$ I
}: M1 d. |2 \& R. A/ W7 k0 z
else if (document.layers){- ^0 z0 |, [. N h* L2 U! c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') m0 d. P- ^" X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 `* @. M" {9 Uwrite('</ilayer>')7 h H7 k, h W! j* F
}
! p2 @* s5 Q' R$ H1 ^% J/ xdocument.write('</td></table>') w3 d& F$ `( n6 w
}" c% M1 c8 `, I* y+ I
}
. L& \1 u2 ?6 Y& e</script> |
|