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

|
网页之跑马灯文字特效
//修改宽度5 y5 r3 }9 |% x
var marqueewidth=300
# H! m) e1 X% K; ~$ g! }( z//高度
. z. S# ^ q6 p& h' \+ _4 |& Pvar marqueeheight=258 i' A' t6 N0 q$ j9 o
//速度(1-10)
, t1 u4 l" N Mvar marqueespeed=3; Q' B Y, {- p8 D( ^
//背景颜色
( r% L5 P; V4 \3 s# G# `var marqueebgcolor="#FFFFFF"# M6 U* H" a4 r' _$ o- |
//是否能暂停 (0=no. 1=yes)?: b: T" S* R: i! T
var pauseit=1$ Y* Y0 ?" q6 V' q) e) W, @% r8 }
& ~- x( I% A. C' W6 `! @. e
//修改显示内容4 t( w; _) m( n& e8 D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- Z* U b4 u# F; Z9 J, M
* O7 @0 y, X$ \4 B7 t
: q6 t. E! f# Z% B. ]. u; n# i- q////下面不需改变////////////
: i T; P6 K2 H; G& ]: t9 n/ g
3 T I& P0 Z6 f& y5 ~var copyspeed=marqueespeed S' Y/ r$ N) r. Q" C
var pausespeed=(pauseit==0)? copyspeed: 0- V' W0 A/ p" B7 o
var iedom=document.all||document.getElementById! y( x8 q! Z, ~) Q
if (iedom)0 w. T# j( R6 t! S3 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 Z- Y8 p/ G2 ~+ T4 D) b7 x" q# V V7 rvar actualwidth=''$ q/ c. d. {; `! w6 I" y
var cross_marquee, ns_marquee
9 W$ a; ?6 C" N7 y2 U
8 x) D7 i' C7 kfunction populate(){ c+ H3 X3 Y3 |1 ~1 o' f8 @8 J
if (iedom){& {: i# ~% e* M) a0 i* |3 c) q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 I0 s" G; N! I: \6 v3 g' e) across_marquee.style.left=marqueewidth+8. X5 T" f+ P' t4 s
cross_marquee.innerHTML=marqueecontent
" f: q5 V0 u7 H. _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, ` @! f5 M- F5 l}/ b; C4 Z, k3 k5 r- u3 L
else if (document.layers){
2 Z! l" a' M7 |/ T, [ns_marquee=document.ns_marquee.document.ns_marquee2 a1 H6 v& K2 W) ~( G2 \; t) C7 l
ns_marquee.left=marqueewidth+8
1 q5 k5 Y+ S: yns_marquee.document.write(marqueecontent)2 j. |/ |6 Z; \, [
ns_marquee.document.close(), x j+ f1 ]; H W8 R: K$ C$ N
actualwidth=ns_marquee.document.width5 k+ _( p" m6 @7 P- a6 ]
}
) ?2 O* _( M! O2 C9 Wlefttime=setInterval("scrollmarquee()",20), c6 Q6 ?$ P8 b' M/ j
}# z% [3 n4 _: h6 t
window.onload=populate$ g8 L# E; [; C6 n/ Y
+ B, m# b5 {8 O$ F7 E
function scrollmarquee(){
0 Y1 z o, e8 {7 b. \if (iedom){8 I* [+ v0 p! T! R h2 T& |5 g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! x! Q: x/ c; E7 \$ p {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 z, Q/ u$ p5 c- A: d; C
else. _9 B. _! t0 s5 {% i: A
cross_marquee.style.left=marqueewidth+8
% i& h. b) w) W' w% Y7 k6 Z1 [0 l' w. p4 Z" C$ T- l- E
}4 D+ {0 I' q9 v/ \
else if (document.layers){
5 N3 | }: ~7 i1 nif (ns_marquee.left>(actualwidth*(-1)+8)), F* X8 a2 U+ Z0 Z4 A, M* H# R5 q
ns_marquee.left-=copyspeed
; \6 G6 d& A# f# |/ O8 \: d; }else
' v% }& g; X7 w* h: H4 D0 K3 x) `# sns_marquee.left=marqueewidth+8
5 x0 Z/ B$ l3 w5 s% y}
1 K, W* P4 w3 o, V+ w}
# }- N; e! E1 ~0 @+ y+ Q W
9 f1 A2 n5 W8 l: uif (iedom||document.layers){
- G$ _2 z# x, ?" Z0 Hwith (document){$ f" V& |$ P' a3 s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ s8 a7 M, \5 T% h* x' S* F8 r( f
if (iedom){8 }; o, f' I; I+ k, j" N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 Y) }1 i5 \2 t( a0 v6 kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 s9 C2 Y) ~ x8 `8 h5 x* _6 K2 Q' u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 r. Q, d* t6 ?- L
write('</div>')
! w; r2 m9 [7 |7 A2 m7 h}5 C* r3 ]$ ^8 ?. }- @: d4 B
else if (document.layers){
0 E! a) t3 N: ^" Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! q) @9 e( {* C- m( S2 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 n: i& i0 u! ?5 @6 b% A) ~+ E. ywrite('</ilayer>')( ]; z/ t. }- Q2 {
}$ B9 U% V" V% u( ~+ n
document.write('</td></table>')) p( F. a# E: B4 |5 ~9 k( G
}4 t& e$ A. f$ v6 ^% W% A+ P* ?
}
& X2 x5 Y9 w, q. J" T# {</script> |
|