返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* H4 H9 v: X; f8 U6 D/ s6 Jvar marqueewidth=300
8 o6 o  C: z2 |: ^( i# y//高度2 R+ C9 x1 Z1 y3 l) g* L
var marqueeheight=25- [' M7 X% |0 Q, k: l
//速度(1-10)
9 v! C. t  j7 q0 dvar marqueespeed=3/ R* ]! |; Y" e$ V. c; c
//背景颜色% c+ d% X/ n8 J
var marqueebgcolor="#FFFFFF"* W$ a) P# ]! }* h2 r
//是否能暂停 (0=no. 1=yes)?" A% e% A2 r2 W4 t
var pauseit=13 M' U* v4 q, h

" I' v+ y- P1 F1 M9 D) B* d//修改显示内容5 O1 v; S) C! `1 u" ?; l  J( W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' q) I7 s! l- c6 n# ^
: {2 V7 v2 F# m' r7 C" B* y

$ g: p4 j- w& o& z) `& f; U& v////下面不需改变////////////" K: _& j4 j! r4 Q- q. {1 R

# U- D+ a& l; H7 [+ X" K  |. m! @! b+ cvar copyspeed=marqueespeed
9 n" T7 l- J" g& Svar pausespeed=(pauseit==0)? copyspeed: 0
; E9 I  L3 h5 W% Evar iedom=document.all||document.getElementById
; s) c5 V7 g) m* ^$ O* |if (iedom)6 l  B+ m6 p' Y8 |3 ?4 u6 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# f2 I, y8 I2 L
var actualwidth=''
- ?& s6 W  y6 h2 P, r+ G$ s9 Dvar cross_marquee, ns_marquee5 ^! Q" Y+ f8 E( Z3 i

2 ?/ Q) Z. R! u) t' u) H" ofunction populate(){
9 S$ D2 I$ |# A3 H8 Bif (iedom){8 D$ C, b5 p7 b3 Z7 u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: T! K$ J$ k& u% K% u
cross_marquee.style.left=marqueewidth+8, m, R0 k" R* k2 D3 N3 W9 O
cross_marquee.innerHTML=marqueecontent* j) F4 U9 [9 M; N# {; n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; j$ I! [, R5 \8 M5 f}
* n. A2 W9 Y0 {/ }: h2 k, R  yelse if (document.layers){
! G0 c/ g8 c  Qns_marquee=document.ns_marquee.document.ns_marquee2& v; H2 c/ F5 \7 U2 O
ns_marquee.left=marqueewidth+8
3 U( {. a/ j2 Y" N* B2 rns_marquee.document.write(marqueecontent)
  C1 V* U2 r( l/ r6 o& Ans_marquee.document.close()& Q9 J% `; Y; b7 p5 P4 N
actualwidth=ns_marquee.document.width9 [' o  r# P+ ~3 i- o8 ^/ x& v% I9 e
}
9 c$ B: C8 w# v# clefttime=setInterval("scrollmarquee()",20)
0 \! R7 O* s! n}1 S; K( U+ U1 D( b7 _' J. k
window.onload=populate
( a6 G$ d& }( n9 A/ h' V, L
/ b2 q6 b  u) B$ i% ^; p/ j7 V( Ofunction scrollmarquee(){
7 l4 x. M6 O' _9 hif (iedom){" n  P$ @4 k1 `) s% x4 H+ U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 h) _! m% F2 }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& b5 T) _( \, R' j) ?' d
else, _- k5 V4 E2 T. A( U3 \( u
cross_marquee.style.left=marqueewidth+80 x$ j3 w# F" W
- y9 N6 V/ }" X8 a0 `0 R( H; X
}
6 J' M" m, i2 J- W2 h) zelse if (document.layers){
+ P/ d9 W: [% z- c$ c+ Qif (ns_marquee.left>(actualwidth*(-1)+8))
5 i0 ~( k- J/ ~! a9 s* \ns_marquee.left-=copyspeed+ D1 s6 ^6 _  n3 ]3 o% }
else* d: F( d( @) h, V$ A
ns_marquee.left=marqueewidth+84 c  \% `8 _, W" q, r9 o
}% {0 \( M: M$ I+ Y& D
}# i& b) M2 E& [: d6 i

/ M, H8 }. K  [0 Z0 A3 U5 zif (iedom||document.layers){
! K' u, x% X4 Owith (document){; z2 A- A5 G7 N/ x3 u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  S* |+ P! ~) ]: |% s, L. d5 m
if (iedom){
2 X0 ~$ y4 \5 ?; awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& R9 N- S' Q. F: Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ h3 |9 x/ Z) T0 Q2 ~! Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- }. x* S8 ^2 P: P# T- xwrite('</div>')8 Q2 D( C1 O, W0 n" o$ o0 Q+ u; V: m. n" A
}
( ]9 Z1 l& ?# V9 S0 ?' Zelse if (document.layers){
; P) B- u  S1 E( O/ d' M9 m- kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& \; S% e3 F+ V" X' C& Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" J; B1 T0 ]" x- H
write('</ilayer>')3 T% B9 u! E4 P" ?7 ^( V
}
; K  I9 F% q* k% G8 _* ?4 Jdocument.write('</td></table>')) R1 i" @6 M; K% a) c  T/ S
}" F  r9 ]% u) p$ }* n; v1 \
}
. q: B+ D) M0 q5 G; `# D</script>

返回列表
【捌玖网络】已经运行: