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

|
网页之跑马灯文字特效
//修改宽度8 t- a5 U) k, [* t5 i" q
var marqueewidth=300
+ o3 |* b, l9 {/ u7 n' }; |+ C//高度& J; L( f: Q% H$ H) Y x, g0 g
var marqueeheight=25
3 z$ R8 R4 W* l# t1 z1 E+ a( }9 S//速度(1-10)
1 X2 U% v) w0 f+ S/ }var marqueespeed=3
$ @4 E. k, H0 X//背景颜色
9 Z+ L* `/ O7 ivar marqueebgcolor="#FFFFFF"+ |$ F5 ~& W* A2 t, G% L" q0 q
//是否能暂停 (0=no. 1=yes)?' {" L/ X+ _# d3 `5 P
var pauseit=1
1 X# X3 K/ e' }9 J# o% L- n9 T
6 j) E2 p" M; s+ v+ X, Q6 H; i//修改显示内容
( o! y6 {) k O( y) g: ^9 I* rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ M ?0 `, @2 x7 v X m/ V. J% S a z
) c2 n6 r6 p" i. |5 Q////下面不需改变////////////' \! A- K# v! w' M, E) k+ a: x
1 K" L4 [( y' U5 c* K T
var copyspeed=marqueespeed
! a. R- F$ |+ S- @var pausespeed=(pauseit==0)? copyspeed: 0
9 p' \5 W2 Q$ Z1 A, U, pvar iedom=document.all||document.getElementById
- q; q. q8 w3 F4 D: g0 y; [, ^if (iedom)) g+ S# T2 n6 a1 k. c( m# |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" h* d) `# W; E7 B4 z m2 v
var actualwidth=''5 }1 s- a {' f& a1 [, u
var cross_marquee, ns_marquee
4 c; {5 O7 I* f/ w) M8 ~" h
" p/ s6 B" G$ S2 L8 @4 E$ R( yfunction populate(){
" H( F9 J0 D$ Hif (iedom){+ W6 x" t6 Q: n7 ~! ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 V, @) M+ Y4 \- q0 q2 n! W, |8 Rcross_marquee.style.left=marqueewidth+8
/ o T$ Z% h4 f8 U) `7 Gcross_marquee.innerHTML=marqueecontent
+ K9 g0 s; s# ?6 r9 C2 c6 z( uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 u! T, e* {0 S
}6 p: E8 ^ D4 _/ B1 f l
else if (document.layers){- G" t- g, ?; A% H9 T3 o
ns_marquee=document.ns_marquee.document.ns_marquee2& h8 Z8 U$ }* U% ?
ns_marquee.left=marqueewidth+8+ d* A1 I8 z7 a! F
ns_marquee.document.write(marqueecontent)- I( q0 _: X2 R& w0 e! f
ns_marquee.document.close()
9 E! P' U6 d/ l2 n/ E/ a$ ~actualwidth=ns_marquee.document.width
# E& ]8 m8 W7 m+ v4 y, _0 K} N# A8 {' d$ _# \
lefttime=setInterval("scrollmarquee()",20)$ G, A5 e: ]( N+ Y ^0 p: T7 f4 [
}
) e, X9 T2 V9 g) xwindow.onload=populate
! R& _, m3 E( B8 D( @$ q/ L7 w
( m. j$ P% i. R: E% Qfunction scrollmarquee(){
" b, q7 T% n7 y" C" Fif (iedom){
* R# @ k7 p" cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: D# S( H' l/ Z$ ^$ J. S4 Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) q+ ~6 {' a n- n
else
" @3 L; A6 h- R& Pcross_marquee.style.left=marqueewidth+8
" b5 E6 g; A {/ O& ]) a! I+ Q3 l
}/ a2 M, X' N% C% |& @3 @
else if (document.layers){1 v; i( G& J0 | K- n1 Q% c
if (ns_marquee.left>(actualwidth*(-1)+8))
+ o, X/ n* F% u% a, zns_marquee.left-=copyspeed% ]- g7 P- z" z/ S( [
else }9 U7 k/ Y. c
ns_marquee.left=marqueewidth+8. K# X W% a/ U# a1 K5 c
}
2 ^6 b5 x9 O1 g}
7 y! a" w' m) \7 C" N o: ^% Z. J( J4 u+ T; P
if (iedom||document.layers){
3 k3 i$ d1 f/ f. N! C0 qwith (document){
) k% e6 ~( z s" I3 y, }7 \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, t7 f8 x! G; `( a4 C$ _if (iedom){4 z" A" K. D; X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# ? b6 M& N8 F0 X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" ]1 E5 V* M) I2 o9 k! Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 S& @" D3 `+ V4 C* X) w: }
write('</div>')4 ]9 z0 v4 F( T$ L& `- l: h2 [/ r
}! `+ G ~6 Y! v- B6 F) ?& ]: Z; M
else if (document.layers){
% L: W0 Q6 c/ p) l! Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) z' n8 j+ V1 Y4 A' vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 J2 o x1 l( Q, z$ A
write('</ilayer>')4 G& B% d! {5 A/ `7 }
}) Z z, {! [0 M, v% U; W
document.write('</td></table>')
. n& t0 h9 m* B% d' i4 y, z9 Z}* F2 U: W8 y+ U1 v d# ~
}
" q# F& W% y- e" H$ `: s</script> |
|