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

|
网页之跑马灯文字特效
//修改宽度
3 B7 F8 s4 y1 K' Lvar marqueewidth=3004 u8 J3 ?4 _4 x, s; Q
//高度9 `. P- l7 t: e/ D" O/ d( O* s
var marqueeheight=25, b, F/ b! o* X! t' A d+ m" L Q9 s
//速度(1-10)' b( p4 Z# C2 Y' O; P
var marqueespeed=3
) M* W4 \( Y& J" t$ X. O//背景颜色
$ X C7 o7 ]* a% Z) c! M7 x- zvar marqueebgcolor="#FFFFFF"
& T% D- N( V) B& @& u% f* s//是否能暂停 (0=no. 1=yes)? W3 |* z* r6 P
var pauseit=1
1 d" b- d. X0 d* c' f: b w" q/ x" h* k
//修改显示内容# X+ G# e: t3 u1 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# C! k; c& b c" p0 o9 g9 ?% e
8 c9 B" Y' R) d9 M0 G1 E* ~4 y7 x) d! |& O D
////下面不需改变////////////
1 |, R, d* K/ C4 d6 T; F& F
+ R5 v8 \7 w5 |, Cvar copyspeed=marqueespeed. q' b% ^+ X2 _! N# V; {1 C, v
var pausespeed=(pauseit==0)? copyspeed: 0
! X. s# n& d0 d, J1 ovar iedom=document.all||document.getElementById( f% d% k$ }) A% g5 a, ]
if (iedom)
U- B% p; [* T, j# s. X b1 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" j! ?2 }1 _- s+ Y; Q9 uvar actualwidth=''
) a- n5 q8 c8 `; w- `var cross_marquee, ns_marquee
. @6 }, P7 @% p+ d! g
/ p6 A! _5 T: p& J! X- x6 ~) Y! A4 Wfunction populate(){
& |3 ~! _( d) V1 @. J! [3 B3 D6 Fif (iedom){
9 Q6 b0 l+ b8 j [* dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: X+ z9 x, s! N* x+ Ycross_marquee.style.left=marqueewidth+8# t( b" F% v, [* ^3 s* C
cross_marquee.innerHTML=marqueecontent
. {9 q5 I* L% e. Z0 |: ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! f) n9 R. C7 |+ ~5 c
}
7 k8 I# l, k. W, p% y1 v5 n( m/ Jelse if (document.layers){
2 i( ], }% G, b$ g& y( `% {ns_marquee=document.ns_marquee.document.ns_marquee2
1 i. Y6 `1 p; g1 p5 J" ~! J/ x8 Lns_marquee.left=marqueewidth+8* q5 J2 E; ?" s9 v4 K, e
ns_marquee.document.write(marqueecontent)3 L1 t# V$ Z# N1 q2 z4 d
ns_marquee.document.close()6 x6 F- Y k* a3 W
actualwidth=ns_marquee.document.width, e, C& s1 ]9 k1 D! _* Z5 ^
}) B7 n3 r- D! d$ Z* f
lefttime=setInterval("scrollmarquee()",20)
7 D2 s+ m) y) _, D" z}
2 }& S4 f. o6 {window.onload=populate
4 t" h' V1 k$ r* n
$ j' G- _8 s' K. U, Lfunction scrollmarquee(){
2 j, n6 \. I( t, nif (iedom){& Y. d: q& X3 o+ ^+ J& R4 ?* y& A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); d/ Z& A8 l9 G* t: f) r F8 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; G3 E; B; X4 t$ selse1 Z4 V2 t3 K6 }5 V
cross_marquee.style.left=marqueewidth+8% x3 m: b- S- T
9 S$ j+ H. i0 D1 ]7 C0 m' K1 ]}
5 n" L# `2 P5 W. m0 G) Gelse if (document.layers){4 O, l4 I8 u& i4 f# y, k6 o
if (ns_marquee.left>(actualwidth*(-1)+8))
; Z& B* n) c8 W& c9 b+ H+ B qns_marquee.left-=copyspeed
" ~- f2 O& ^6 T1 D, K) `else
+ Y! l$ w8 A, I9 wns_marquee.left=marqueewidth+8
7 w }4 a" I0 M* }}
! r" J, p8 x( V}+ t/ H* I! U4 Z W5 G$ w! x1 X' A
5 U. Y1 o. F8 Y( D) u( Pif (iedom||document.layers){# l9 i$ i7 G" g' c# e+ o
with (document){
" `; i( x0 q Q& Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( m5 U4 P: B. j; C0 ]; _2 Qif (iedom){
" d8 ?! p y& ~$ s5 L. Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' g) D8 z2 G8 h+ l+ c, e- xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): W G: C; \( G2 t0 B2 b6 B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 p J! a( ]$ u/ K
write('</div>')2 P! v1 W# a' X, q+ q
}
- K: ]& { e3 o: B. |9 lelse if (document.layers){2 K: _4 C/ P8 C1 O$ X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 t8 M' @4 p" Q$ @/ Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 B. K/ M8 G" k( r. Q7 g! b
write('</ilayer>')
% q2 L* _0 b; B; p( ?! |% Y1 ? ]}) M; q4 G/ T2 n3 a" m' V
document.write('</td></table>')# U( q1 `0 ~9 I }" c
}8 L/ P5 d5 j5 B0 U+ o2 ^8 w! j
}5 w# C9 L8 n6 G/ e6 f/ w
</script> |
|