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

|
网页之跑马灯文字特效
//修改宽度
5 u/ ~8 i5 B" N% ?7 X+ f* i6 Ovar marqueewidth=3001 L `, y, U C; ?/ W/ Y
//高度
" N7 W; s& M- f* Y$ B+ U5 o2 gvar marqueeheight=258 [* a6 R9 h7 c; i7 r5 y: _1 k- R! M
//速度(1-10)8 r2 m5 E: {+ y- l2 E
var marqueespeed=3" [3 K' }2 j/ m* b3 W9 f, i
//背景颜色( t3 B# Z' ?- x3 u
var marqueebgcolor="#FFFFFF"
( Q- G4 S) U' [7 b8 f% f2 ]2 T//是否能暂停 (0=no. 1=yes)?
& V; ]+ x0 ]2 J4 j9 G; M. Zvar pauseit=1 F2 O. v9 D: E2 \* V
0 g9 S7 F" g% Z7 ^+ }3 U/ z
//修改显示内容
+ ?* l) p+ y# Y2 R6 y2 uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ ^. u3 m i4 y# V7 f) ?$ o% r' X3 L% ^4 G5 G
) u' d3 L1 @ f' l' W: `# }
////下面不需改变////////////
7 m4 y! e$ y1 w5 \* S* ]0 U7 x L' U8 [( `8 [0 c y7 F
var copyspeed=marqueespeed7 _) ~$ B# D6 e1 N
var pausespeed=(pauseit==0)? copyspeed: 0, X9 x* f3 Y8 C3 a4 I
var iedom=document.all||document.getElementById# @! w1 T3 K! m( l
if (iedom)
9 u% l3 I8 P9 b( p3 b, u# r5 ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 j1 J& v4 ]" \' W) O
var actualwidth=''
$ w- b8 y2 e6 ovar cross_marquee, ns_marquee p' `1 O# ^1 ~9 }9 J2 K$ L
, H% I1 [/ l+ f$ p/ i: }function populate(){, v. S5 u+ V% B% |
if (iedom){
- G: G+ w2 ]- u8 c/ |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ K2 e, _" J: k& a; p# P, S! Qcross_marquee.style.left=marqueewidth+8& T1 d% Z+ v5 D& K, F p9 P
cross_marquee.innerHTML=marqueecontent2 A5 g" n- Q+ p4 m6 b P# B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, J% j; S) N2 |! d% G. G
}$ @* y# c, L" W0 E8 t7 E
else if (document.layers){# x3 b+ C* d# P1 s5 ^
ns_marquee=document.ns_marquee.document.ns_marquee2
# u& Z, b/ l8 \: e3 v; [ns_marquee.left=marqueewidth+8 w0 f8 N+ Y6 W( L, }% z
ns_marquee.document.write(marqueecontent) e% Z$ A) G* y8 }) O. V; j4 E
ns_marquee.document.close(), X/ M" m; k! e7 _ e
actualwidth=ns_marquee.document.width2 S# b8 s9 D; Z, }' c9 c
}
$ ^1 p. D1 }3 N N8 ~. Y/ \3 `: Llefttime=setInterval("scrollmarquee()",20)8 P ?2 s: {0 i9 u1 G8 N2 ~
}! b/ R! v9 A9 ]4 \! J" @. ]& Q
window.onload=populate$ U: {; K s, L7 s( B2 d' R0 Z2 g
* E! U% p( C4 V7 c% ?function scrollmarquee(){
$ i& T/ b. p' E4 o& B; x/ d2 Mif (iedom){
2 n* t4 C% P" E0 J3 Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: Q0 v( T9 E, u' _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! E7 p ]; V6 ]* Z% x7 q: Delse
! \/ j2 K7 i$ f+ e' R; i8 f3 scross_marquee.style.left=marqueewidth+8* R* U( z4 G! m* |
( b& L% O, \8 p: e" r$ n6 H$ `5 O
}
3 J) c1 S" j) `) w) D- oelse if (document.layers){
& {: m6 H6 |$ bif (ns_marquee.left>(actualwidth*(-1)+8))
& p$ O9 M! c2 e" u' u1 m* ~* vns_marquee.left-=copyspeed
$ s/ t) c) L3 F, i# Celse# i) f3 W; z2 W7 _- ]7 E2 L( T; q
ns_marquee.left=marqueewidth+8
) G# p! u" N) P4 [( X" o# Z6 ^}
! a, p1 I+ I: K$ q) e}
! a$ l8 }2 j4 t8 j4 r7 _$ `: x' w, q, y; E# R2 ?2 C+ U4 v* @8 z
if (iedom||document.layers){
" H& p$ v3 p/ d8 r$ V1 K0 w( kwith (document){% c, x: Y/ j* |, c! S6 s, j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% K$ v8 a P5 [* x/ @1 K; y3 D8 qif (iedom){# v3 Z/ G" z# U* r5 g3 Y* {* R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 q) R" c8 z/ ]4 K x: nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) h! F: h4 K. Y+ W0 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 q$ ^, n$ Q5 a5 [/ e
write('</div>')
) ^( _+ N1 s* F# q1 y! {}2 l& h7 |, o3 ~ N6 G
else if (document.layers){; X$ k" K( B& b% z9 n+ |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% G" q6 b/ @: w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. d" D7 n$ b8 r* ~+ P* h0 Rwrite('</ilayer>')
* f* ^* [1 N) J, j) ]9 W7 O4 o}
6 M. Z8 [8 `9 y; [" [# M Q! Ddocument.write('</td></table>')8 W* ]5 `5 J3 G
}9 m3 }' n( c* a( u
}
9 g8 x/ c7 _ S$ ^* c</script> |
|