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

|
网页之跑马灯文字特效
//修改宽度
& u2 p! D; h! Q d' n" f7 `var marqueewidth=300
5 M E- X; ^5 ~4 ~; W. j//高度
6 i' f8 {: t$ ]; Dvar marqueeheight=25
" g+ M. ~3 c- p* S: ~* z0 j, F//速度(1-10)1 @+ M" C0 @" G) X$ D+ r4 C
var marqueespeed=3! R7 P! b: {6 x0 C0 {7 j
//背景颜色0 A# @1 ]; p( u
var marqueebgcolor="#FFFFFF"% o# i- ?" V' N1 w! d0 M/ Y, p" u4 l
//是否能暂停 (0=no. 1=yes)?1 x0 v- k1 B* F" X/ Y
var pauseit=1
8 s4 `/ ?! {# n( H- X( K6 K( i, i' @/ l+ ?
//修改显示内容4 G+ L A5 M! M5 C: O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 U' U$ Z/ V8 w6 U) d
: B: D# R" j) ]+ V' w) v9 I' P. p+ u' s3 |0 Q0 `5 f2 ~# e
////下面不需改变//////////// n; d# q7 Q$ J3 {- v ~
2 ^& r, |% z; ~2 Pvar copyspeed=marqueespeed
, s! Y' w% u% S5 n. S; e, Evar pausespeed=(pauseit==0)? copyspeed: 0' g6 M5 a6 p) T1 v+ U+ v( b
var iedom=document.all||document.getElementById
* \' s$ K! q h; J2 aif (iedom)& q2 r" N& i K5 s: o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' r: b% `5 ]8 `2 Q8 C7 H
var actualwidth=''
3 C3 W; R+ `9 F4 s8 h! Cvar cross_marquee, ns_marquee% b+ }, |& }2 i: K6 s( w
/ o! O* y9 e1 V' j$ ]function populate(){
, y/ ]- `- z$ B! Iif (iedom){
' @7 L! x# K$ }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" j. T% L- [. C8 M
cross_marquee.style.left=marqueewidth+8
; E$ r3 s, W7 _6 ecross_marquee.innerHTML=marqueecontent# P6 B3 q9 Z* v0 t! K& E4 W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" D& [+ Z8 G/ N1 w% G# N8 ~$ _
}+ w# S1 K! K6 {3 v, e! x
else if (document.layers){7 w, B: g4 o- a1 U
ns_marquee=document.ns_marquee.document.ns_marquee2/ l# i6 t8 ~5 p4 _9 @" _; k
ns_marquee.left=marqueewidth+8/ W o" O! ^& b0 y
ns_marquee.document.write(marqueecontent)
* b) [8 I8 A" O0 G; j' _) r6 ons_marquee.document.close()
4 d- n5 s* [/ nactualwidth=ns_marquee.document.width0 g2 l3 q1 G5 r0 o! U, r( a* G
}
* R; l" F4 O4 ^, z4 t1 {/ `lefttime=setInterval("scrollmarquee()",20)6 D( J1 S }1 k3 l$ s/ e1 u
}
5 l' S& Q& Z$ R8 a/ Wwindow.onload=populate j9 j9 {8 M& `( l
7 ]4 \5 |" I- tfunction scrollmarquee(){& ]; o" y. [3 W- a# S. v$ e
if (iedom){6 z. T1 R+ Z% d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* b: w6 `: k) V; F7 D) t- I$ }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; Q N. @# x1 o2 q, N
else% \+ q5 e G% d' u% K" L9 [3 g
cross_marquee.style.left=marqueewidth+8
# ]7 P0 s; s, }* B8 @
4 O* ^! q% r% e4 r& \) S- e/ l}! L1 S8 C$ D7 q" ?# o1 x7 ]+ [6 C
else if (document.layers){
( Q8 T6 O+ E& d4 S. iif (ns_marquee.left>(actualwidth*(-1)+8))5 G8 _+ L) ^8 R, w
ns_marquee.left-=copyspeed% n1 a2 V) F" D* S8 u3 q0 |
else
* U% w" Y& p c+ {7 ?- A0 nns_marquee.left=marqueewidth+8( Y$ N7 y8 m! i/ j/ {: D
}9 j0 A: U6 Z: |4 U- O" a- ~
}
' G$ ^. n3 L( l" j: o" c, U: B: I# `! m5 [ d! f: F
if (iedom||document.layers){
- U# h8 y' F- r- ~( D5 M# xwith (document){8 k" b$ i; |' D0 A" \# ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ [( x& P- i+ s5 G5 d: N2 {& {* E& v, I
if (iedom){7 T1 P3 P: h/ M- z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; n. g( o0 J( U" c8 Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" S6 R2 A8 n4 w/ L Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 _, k: j- q1 i3 `: U4 j( e& kwrite('</div>')
; u# b1 F* ?7 C}- M! j/ {. V% y. B$ U+ b) K1 i7 v
else if (document.layers){4 D* U% j% K# M- H" |$ o' q1 c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( Z$ a5 Z- }+ r3 o' l- R% m5 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) e" C1 W$ Z, ~' }( n P$ U" a
write('</ilayer>')# a5 U7 }& u0 J* g
}( Y9 W/ A: B- w) @; i2 C5 N3 Q
document.write('</td></table>')
& F' k0 E) I, U) p) e1 _+ ^' L0 N}
9 B6 p- b5 L3 E9 E# d1 M}
/ {3 Q! O) p3 C0 \! c; u3 @. m</script> |
|