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

|
网页之跑马灯文字特效
//修改宽度( C* y6 }+ x0 R( @, B
var marqueewidth=300
$ s" Q: o7 S n4 X" `1 I4 P) u& x//高度: G0 n2 _8 p/ D, D
var marqueeheight=25. M T# L8 {' Q) F9 _1 Q) p `
//速度(1-10)
: K; R* J- U6 a5 E2 P# Qvar marqueespeed=3# G" C m+ _6 F" }0 ?
//背景颜色, w" q/ i9 [' G9 [1 V" g
var marqueebgcolor="#FFFFFF"
8 Y( I" q+ E: Z% b2 z//是否能暂停 (0=no. 1=yes)?
$ k4 ?- [+ i( L% M5 U& vvar pauseit=1
, {2 w1 M& \5 ^# `- f3 `$ j4 H& E, ~( Q' |, }
//修改显示内容) n# s1 k' W% i& I' F; o: x: h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ O4 ^% p M. M0 Y% }" E3 j- K& u$ C/ l) [) g3 l' B# l
' F# S1 Z7 z0 C' n- M////下面不需改变///////////// Z/ ^2 I" r( m- o4 p* X
3 d$ W; ^# T" [* a4 `" A$ H/ R& X0 K
var copyspeed=marqueespeed1 h, o, o% D" f9 Q; P3 s# D
var pausespeed=(pauseit==0)? copyspeed: 0
2 |: ~6 ~( v6 Q# u7 Lvar iedom=document.all||document.getElementById, O0 n0 x8 d; _9 k- `
if (iedom)
& B; u& {/ W8 e7 n( I5 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), m6 A2 v0 _$ l6 ?; f
var actualwidth=''
. {$ P8 S/ f. ] H1 K5 w$ Mvar cross_marquee, ns_marquee4 O' X0 a; y" W; L0 I
/ d# J8 B1 L0 F$ |! Z6 l( T
function populate(){$ j* J: x1 l; H9 F; g' f
if (iedom){3 _2 ], T3 e5 \( p1 |; ^ b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( p$ m. M; k- l0 ]# ^# S$ z7 D8 D
cross_marquee.style.left=marqueewidth+8& I; s5 `! p' x, b
cross_marquee.innerHTML=marqueecontent/ z) ?9 [7 L1 m3 X: {- |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& [: L+ A7 \, r& {4 v* j
}
$ g7 a8 Y. ?+ C$ c) D5 S% Qelse if (document.layers){
+ B. | S3 l& i% W6 a$ rns_marquee=document.ns_marquee.document.ns_marquee2
" f' t( ]4 x# r7 ^: |ns_marquee.left=marqueewidth+8; e3 A6 X7 K% j e3 A' x
ns_marquee.document.write(marqueecontent)
' L, O2 j8 Q" t2 f; y& [ns_marquee.document.close()) f3 x# j- c3 @3 `$ ~- S- a
actualwidth=ns_marquee.document.width$ U: l& v; n* p: d+ n9 G
}
6 ?" r6 N2 G6 E9 w- plefttime=setInterval("scrollmarquee()",20)+ j6 _2 W7 R P( Y: v
}
) H: m) H9 I! \8 I5 s* k6 _: cwindow.onload=populate. o$ P# J. ]9 v U3 d) w+ a0 F2 D" e
& e X3 h- T; _function scrollmarquee(){* m7 x1 k6 l9 L2 @: F4 L
if (iedom){
e1 X2 X2 j3 \8 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& ]1 u% d+ {8 e6 |% w2 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
u: ?9 P# o1 p. l8 p* qelse5 ?2 o8 m. F5 r; W* d$ B: k; d. H7 B
cross_marquee.style.left=marqueewidth+8
: [. w, H! {/ w$ d5 c* D8 h3 B
2 A* S# J& f& C# }7 ~. A}. Z6 f7 J7 ?+ t. H# a! F
else if (document.layers){, S# J" A: C- i, W& X" [0 s4 G
if (ns_marquee.left>(actualwidth*(-1)+8))# }6 D" t0 ]- S
ns_marquee.left-=copyspeed
5 ]* w0 s0 \9 Relse
) n6 Q% R/ s# [$ Y# o7 |; Jns_marquee.left=marqueewidth+8
1 y7 {& s: E+ o8 r) m' T) \8 F}$ c, k" H7 r8 X* W! i
}
& W5 z/ ~. j8 e, t* D& w0 f% o8 n0 o2 c7 m
if (iedom||document.layers){
2 g2 N- O( u% X4 f' H% Q, \ |6 o3 D) Hwith (document){5 }4 J( p7 n: A& j1 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. v$ \0 _! b9 ?5 u, V7 Pif (iedom){
' O; F: k4 T' Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* |9 h/ L* e7 a& o6 xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) }& {+ q- m- O' [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') ~( ?5 D$ t+ L ~6 H9 n& f
write('</div>')% u$ c1 m% {3 A0 o c; s- m
}/ i2 w9 }6 w R$ c3 F* R8 n
else if (document.layers){' Y" L9 U. ~' b- k% \% e- s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 C S& l3 J) i/ j2 x8 M3 W: S |9 xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 `6 {9 n- g! r4 U* Q
write('</ilayer>')$ m$ V$ q. Q8 H4 J% V" K" R! J
}
3 U/ R9 g3 {- n( Bdocument.write('</td></table>')
, Y. a: d3 f! b% z5 A}
7 p% G" `. q; ~2 T' Q}
( _9 B% P% f! q+ R! ~</script> |
|