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

|
网页之跑马灯文字特效
//修改宽度' B+ }, u% `% c. x/ Z
var marqueewidth=300& g, D. a( H5 X6 ?7 E' o
//高度7 N# l4 M7 F, N2 h# k5 k
var marqueeheight=25
2 O7 |. j% m8 u//速度(1-10)
5 a0 C/ w* o6 y0 N: e5 k. ?3 zvar marqueespeed=3
# B7 I5 z0 K& I& J! v- I9 G4 ?, W//背景颜色+ i6 P1 a7 j, x2 m' V3 J, i
var marqueebgcolor="#FFFFFF"
6 n f) }1 U1 O//是否能暂停 (0=no. 1=yes)?
0 f4 O9 Z8 Q% [6 a0 s/ o, Bvar pauseit=1
4 b( Q' U' s+ T+ l
& x9 c4 e! F4 Q+ v' c: v$ f! O//修改显示内容
. n, r% B8 z" q) e/ r# c' W- Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ L1 u$ {4 R+ ?$ T9 b! {% H' T! {
- T" Q# C. c* c3 I$ j1 |6 D0 D. p- A
4 G6 W+ b& c. s4 s////下面不需改变////////////
K# G; M- t9 W* }! D/ Z d
- j% k+ f/ E/ V- Y4 s! cvar copyspeed=marqueespeed) R3 E3 L0 z. I* l+ ^
var pausespeed=(pauseit==0)? copyspeed: 0
" A; G2 W* ~8 E" g% N2 lvar iedom=document.all||document.getElementById
; M. B5 d7 k' R' |if (iedom)
. s# C. q7 ?+ H! s( A/ m3 x: pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 }" a$ v* q5 `+ p- _3 g! z, r# T* X
var actualwidth=''
: n5 N! V. k9 Q+ w3 d. B- N" c1 |var cross_marquee, ns_marquee
/ W+ Z1 S* o( N& I+ L
( ]8 h; x; a2 o' M2 pfunction populate(){0 _7 h. p$ B/ I+ h
if (iedom){- ], y! v/ F3 _1 z+ r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 C# |& M1 Z$ I8 b7 E" O, A) E& scross_marquee.style.left=marqueewidth+8
0 l6 T$ s' p% S4 f( x* G- ncross_marquee.innerHTML=marqueecontent
) T( C9 d4 T2 X7 W$ Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 X. D' K* P+ ?% K; H3 }1 W}
! y6 x" i6 e8 h1 z) E8 Eelse if (document.layers){4 ^: ~1 b5 L3 k
ns_marquee=document.ns_marquee.document.ns_marquee26 w9 y' ]( c/ {) T' S
ns_marquee.left=marqueewidth+8) q4 ^# s# n. [
ns_marquee.document.write(marqueecontent)
& D* A; Z S ~7 T( mns_marquee.document.close()
. K# @' s7 p. }$ j9 Y2 mactualwidth=ns_marquee.document.width5 }; b8 d U5 h6 \# X/ R
}0 s3 N @' d8 s( B7 `4 s
lefttime=setInterval("scrollmarquee()",20)
8 J9 R, B* c) e* F}! d V2 J* U0 f: y
window.onload=populate
, F3 s/ G) o. N, K, E3 X8 I7 y. Q+ o8 b
function scrollmarquee(){, p* T0 }6 d3 k7 i+ x7 z- u* _
if (iedom){$ v7 A/ v+ b: q) [0 f9 k+ K# i" g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) h. L. _4 Z6 S3 g! _# ?, k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# ?2 k5 a4 f, ]. i% `9 P5 ?
else+ t6 D" Q, V$ K! x
cross_marquee.style.left=marqueewidth+8$ R {( _6 h# ]; B" [# o
+ b, {2 t) K' _3 ]
}
: @, c: ]/ i4 jelse if (document.layers){
& [' R; ^" c3 _3 W5 W1 Lif (ns_marquee.left>(actualwidth*(-1)+8))
" H4 r4 J) {/ M' Qns_marquee.left-=copyspeed
) Q' m: w8 |) q! T5 Jelse
6 ?; r# j9 C" f" Y% X- [1 i4 C/ bns_marquee.left=marqueewidth+8
" U; i& Q: S" W+ i# ?8 K- t8 q3 t* p8 b}) W' Q# t. y" c- m0 x( g
}
1 V8 F4 y& ~- G7 w* l) p! ^& R& y) a9 ?5 G' e- i: N5 [
if (iedom||document.layers){ m. n3 I' X& t1 A2 z. F- t
with (document){# a- q5 {" P6 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 x0 S8 R: g% ]9 H* e: W: O
if (iedom){
`9 B* r: g$ u s4 W; ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" k: [) ?$ Y/ ~& }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 [! `% u, W6 F3 l- V) I* ^, Y- fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% _3 o, X& A1 h/ k8 N# v
write('</div>')
4 W( y9 s) G7 ^6 l}- V" \+ P5 O* Q& N- T3 M
else if (document.layers){: D$ ^% i3 |% X) y/ S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') J" p. x9 Q. I1 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# V/ p3 m6 N1 N1 x4 {: I8 q* R. I
write('</ilayer>')/ r# g$ m% [3 T( |
}- @. r% |* e' H7 s+ s# ?0 o
document.write('</td></table>')
7 Z8 s) r4 ]& u! N) R/ z C. t}
( n5 H3 N3 B: B0 n- }2 @}3 s6 V0 r: Q2 _$ n( [+ Z, c
</script> |
|