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

|
网页之跑马灯文字特效
//修改宽度
1 O& u" g% a2 \6 U2 |7 t. i- Dvar marqueewidth=300 [9 i2 y: c, ~/ S/ s, u
//高度9 Z: E1 R) J+ s5 ]8 n% Y4 u, V
var marqueeheight=256 Y+ a3 `5 J. |" H4 G
//速度(1-10)
0 G/ x2 X; m6 O) Y; yvar marqueespeed=3
6 k& p4 j7 `2 g! }9 G7 W//背景颜色
! y. ?/ X0 E& H6 z' c) G \& bvar marqueebgcolor="#FFFFFF"
6 n5 J* k, b0 a# b ~//是否能暂停 (0=no. 1=yes)?
0 e3 n# N- C$ ? i" Jvar pauseit=1
# _5 X" G: S0 V* q9 e2 w+ t; {4 U) o" _
//修改显示内容
# |/ J) K0 p5 y3 `& nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 A" ~8 Y ~$ v! Q5 F. x
. O" V( |# ~+ c+ D: o- r7 |
. u# _# u; L# }0 _9 ^% M% X% c////下面不需改变////////////- `: ~! l6 c8 |; z5 Q' U
2 G- I# D& D- I) f4 L5 Evar copyspeed=marqueespeed; Q- v( }' s7 y( {. [; u( o
var pausespeed=(pauseit==0)? copyspeed: 0
+ j+ t* b k, E7 Jvar iedom=document.all||document.getElementById1 {/ o6 V2 x3 U1 Z6 A9 d- f
if (iedom), w. J9 a! P' t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, R, Z1 l& f# Dvar actualwidth=''
2 ~7 J! i- J9 x6 q" d' rvar cross_marquee, ns_marquee
I+ Z- _+ P2 V: P. E2 h0 J5 c* \1 `( |
function populate(){
6 @" |& U' w9 ^0 D* eif (iedom){
O7 N0 i0 h" k% ~2 @% P- z3 m. j& hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# \3 P F9 Y" V1 ocross_marquee.style.left=marqueewidth+86 U2 A+ P5 T& m1 ?& H; C3 G
cross_marquee.innerHTML=marqueecontent
( h& {; v! V w \# o3 V( zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 ^& n- x7 U2 e% V: O. G
}
2 b- _) ~2 n) y! [7 @$ n- Eelse if (document.layers){
N5 K" ^) c6 A: V8 Y" r: Uns_marquee=document.ns_marquee.document.ns_marquee2
9 ?0 v7 e& i5 n4 Wns_marquee.left=marqueewidth+8
- o |5 H8 o* `( f1 U; h5 y+ K& Rns_marquee.document.write(marqueecontent)
! Z/ B/ I" J R' rns_marquee.document.close()
5 [; _6 y) `( a. U w6 o( k0 _" gactualwidth=ns_marquee.document.width& b1 V9 c: x" U% Z" p4 W2 f3 p
}
% C" f" F+ M: v" @8 [; E! ~: U5 E3 ilefttime=setInterval("scrollmarquee()",20)
' A" l* {- R4 `; X6 s}
" t% [4 @! v5 ]5 ]2 M2 xwindow.onload=populate! ^# l" j0 A/ [; S( Z5 x3 w
! G) q- r: X, j1 V9 S" a
function scrollmarquee(){
/ Y! t" {; R9 i. m& C4 A/ Q# v9 f7 Uif (iedom){: ?- @1 U# Z9 o+ T% i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 \9 t$ Z" U4 j2 \0 pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" l: W2 y$ ^* ?" i1 {else- O6 I& v3 B8 Q( E7 C. I
cross_marquee.style.left=marqueewidth+8% H7 s- Y5 A+ O2 C- C( f; G
% P& o' ?, \5 @! x9 k9 r
}5 `2 Z- m) B& ]. @
else if (document.layers){% u/ B' |2 Q: l
if (ns_marquee.left>(actualwidth*(-1)+8))8 \$ ]7 s9 {8 t9 B2 a
ns_marquee.left-=copyspeed
: L1 W& g& @2 N; I) nelse
; a9 I4 L. j' E$ d+ ins_marquee.left=marqueewidth+8+ k) ?4 N) ~5 l$ k( o# Z2 F |
}
( z6 S4 w4 M5 e) ?- Y2 q1 w}$ }" m4 e B( c5 K( t
; K# }! E$ Y# K) x. ~& L/ Eif (iedom||document.layers){: S( G: C, V; T5 I5 B
with (document){. D. |4 h4 _3 \; S. ~; q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). o/ ]1 W, }: J! x2 I0 P
if (iedom){
+ _- C& z1 ]+ W$ O) E' [0 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
W1 z- \5 ?( t; R; ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# W, }+ U% Z$ N# W; f1 c$ vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 D% a. m- a; F |3 Hwrite('</div>')
- o+ D0 m) O- h8 D$ l2 D}
/ w4 F& i! q; L$ ~7 \/ R; uelse if (document.layers){ z8 y4 s2 P2 u0 v5 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" q9 X* y! |& S8 @1 c6 b7 \4 h t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), e% N1 Y/ C6 E. o) ^6 H3 y
write('</ilayer>')
8 y) S. C4 _1 T7 n& Q' X8 i}: c/ m- C5 u% A: o9 h
document.write('</td></table>')5 X% p2 F& r y/ _7 `% s
}+ I0 H4 Q8 h: n3 n0 [7 V+ Q) d
}% W6 {( E% u4 b7 {8 E; s; F& l
</script> |
|