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

|
网页之跑马灯文字特效
//修改宽度
; ?0 ^7 ?% R, z P" G8 h7 a% L" @var marqueewidth=300
: }8 v: t7 p% m//高度. m$ A! |' |& N ^6 ]
var marqueeheight=25- R9 P4 O+ Q" _- \. J3 d4 w, D7 F/ X
//速度(1-10)
, J1 e" C2 w" f7 Yvar marqueespeed=3" O- |( n- S) `& y8 T
//背景颜色
, I% B0 c5 h! ]var marqueebgcolor="#FFFFFF"
& \. o! V' i8 ~8 t//是否能暂停 (0=no. 1=yes)?
7 S4 H/ m' O3 }9 m! _6 Rvar pauseit=1
6 Y$ t, m- L6 O8 J- O$ G
* k2 l) c/ u7 W6 P7 h//修改显示内容
0 ]7 p. k' w" u9 M& evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': p7 m: g4 q' o5 _
! C3 I) ], V: V% A7 `; D
# @* C1 [. V; K+ ?6 |$ b////下面不需改变////////////4 b- o, ^; B+ y! p+ q: b+ u
1 p: `- ~4 U: e7 l( Y. S
var copyspeed=marqueespeed% E: f; p4 q, `2 F
var pausespeed=(pauseit==0)? copyspeed: 0/ {. t/ ~! `1 i" y
var iedom=document.all||document.getElementById$ ~0 S+ N, Y* K. P: J
if (iedom)5 W c0 O# Z7 ^0 y4 e" q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! Q, L! [' P* i8 V. l. }var actualwidth=''
) C r- A5 [( @$ m0 tvar cross_marquee, ns_marquee
0 F; ~- C9 d8 A) k# c3 n; S/ V( O( |' f. f' k6 h$ D ]. A
function populate(){' d. y1 I! i; ^9 C+ d3 Q
if (iedom){! Z) ]9 |" o1 M0 v4 Z9 z( f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( H6 k/ l9 |! G8 | gcross_marquee.style.left=marqueewidth+8
b) r V+ i& w: H% Tcross_marquee.innerHTML=marqueecontent
+ ?6 S2 x% J4 ~& ^! Z( l1 T. s6 P5 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: N+ P& G0 H# g5 a$ W
}
* d" W0 W- Z T$ N9 n* O6 \else if (document.layers){
* h1 `1 e! a# o0 @. _& ?9 |ns_marquee=document.ns_marquee.document.ns_marquee20 ]$ o2 D; K* h9 l6 {
ns_marquee.left=marqueewidth+8
4 S1 ]# T* N7 [% O6 R; \* pns_marquee.document.write(marqueecontent)+ b7 G' B, m) w8 J) d0 @& r
ns_marquee.document.close()' e4 E+ g, e0 R7 K/ o
actualwidth=ns_marquee.document.width8 _ m* s+ D6 y$ b/ N! o8 I0 K
}
- ?5 x. ]% f6 Llefttime=setInterval("scrollmarquee()",20)( \. Z' s) D# I& f5 l; k, V6 Y7 U
}* N% t) n- B, a1 a2 E! P
window.onload=populate% i1 U. U7 m: `; H
9 _8 g( _) p! t p5 Gfunction scrollmarquee(){
% u+ h1 A! W7 F1 q5 l0 m8 G( _! tif (iedom){
0 | N& o* a1 L V8 `8 d" jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% X4 d% Y$ H- J3 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! M. b2 O1 B4 j/ j+ E% {7 k* o% V: `' c
else" C5 A8 y8 [5 {3 k9 c8 ?
cross_marquee.style.left=marqueewidth+8+ o2 @. |, g' z9 `/ b3 p6 Q
0 I# C7 f7 _. M& P
}
/ `4 \8 s3 n( \% J7 h5 C0 y0 ^else if (document.layers){
8 }' ^' ?8 i0 p: j! gif (ns_marquee.left>(actualwidth*(-1)+8))
& v9 E {# B; X1 a8 l& ons_marquee.left-=copyspeed/ g* d% [# n- C( ?1 Y
else4 ~/ g3 ^* m3 R! N. n* {
ns_marquee.left=marqueewidth+8
: M" c5 u% }2 n8 @}$ g6 i. ^; C3 D3 Z
}
4 b. a0 o. P1 _
9 Q' D# ^7 q+ q, p, Uif (iedom||document.layers){
% f8 S8 [, v1 z) ^' ^0 cwith (document){
) }& z) z1 s8 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# `$ `# X# }" w# O' C+ o( fif (iedom){" u# i' b. n; @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 h6 e& [0 C' lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: s4 M! v7 @( D e* |7 D# o) t4 `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ R! |, x/ y0 mwrite('</div>')# \% O' \4 X9 E( `6 m
}, m7 s8 j7 c0 q; v: i
else if (document.layers){
7 S3 t1 i& x; X& G/ awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ N/ i) ], F# G- V, o( f" S) W% a! ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. x, M2 x8 h4 dwrite('</ilayer>')5 I, e7 O* b& {3 H
}
4 Z" v- P; |1 r& Gdocument.write('</td></table>')
( u+ {# o: s7 P2 [/ ?3 Q}8 z+ W6 U/ _4 t% R! |$ A6 {1 l
}
4 B" G7 |0 ^: }$ T c</script> |
|