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

|
网页之跑马灯文字特效
//修改宽度
6 P* w7 w. e0 w% vvar marqueewidth=300+ i" A8 C2 t" M; N9 l+ f
//高度* K8 g7 v" c; s3 }# x
var marqueeheight=25
7 ]4 p: K2 T1 U//速度(1-10)# u; s# J; r1 w, g8 ~/ ?' d0 A
var marqueespeed=3% h+ {2 Q, s0 F: y, `
//背景颜色
* a! R e! B7 T( z: bvar marqueebgcolor="#FFFFFF"3 t. G- K( a- `3 }5 E+ p
//是否能暂停 (0=no. 1=yes)?3 I2 ^/ t' o+ I& i5 c6 G
var pauseit=1
$ A* k- b. ^! b3 L/ |( q, r' S
( P k k: s8 |! D1 Y# F: u4 b//修改显示内容
! O* E3 v3 z2 p4 W$ F5 ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 ^. O1 }/ r$ B8 w8 f1 C- y
4 K. h; T! N: {' r" F- G# `7 s; _
, ~* v6 \/ F( t4 F////下面不需改变////////////
! G/ K$ _( w& }( k2 }
1 @% r6 }8 @1 w/ Y4 e: J) hvar copyspeed=marqueespeed
" `" P5 T; U0 g3 }+ ?2 H' R/ E4 H+ Fvar pausespeed=(pauseit==0)? copyspeed: 0* C7 v( l; l& R- H) Q2 I2 _% W( l
var iedom=document.all||document.getElementById
1 _$ Q* w0 n8 I$ r+ [if (iedom)
. r! u& _: Z8 m% f9 cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 l. H0 N: `8 t" p/ D& _3 C- L
var actualwidth=''
' A4 p1 e& Y5 P( Nvar cross_marquee, ns_marquee
7 O) D- I- s3 Y- p$ N+ ~, N* d
. g- ~8 y6 q1 }) w! A: tfunction populate(){
7 ^& Q9 F6 \8 Dif (iedom){& N* a( S: q* E: d8 N. w7 A; C, [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 R6 B2 ~0 o+ N2 X, |1 w
cross_marquee.style.left=marqueewidth+8. V) R: B1 I( i+ H8 f
cross_marquee.innerHTML=marqueecontent) k/ I+ } \1 A: Y! Y! n- h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- `6 z$ N3 r; Q8 t' q8 } H& O5 V}- x, j; K: p: f4 o6 v( v; ?( ~
else if (document.layers){. C) O: w7 e: W
ns_marquee=document.ns_marquee.document.ns_marquee2. L4 [' M# s, J5 V7 q
ns_marquee.left=marqueewidth+8
! T8 q; Z: c' Nns_marquee.document.write(marqueecontent), ]2 x2 _5 r; B7 _6 g7 d
ns_marquee.document.close()% J# c7 b% Z; @: i
actualwidth=ns_marquee.document.width
2 B. E9 {+ X, K ]7 Z# \2 e}8 g9 J1 F7 o, P f3 Q5 g& K* D
lefttime=setInterval("scrollmarquee()",20)
6 j& X$ C: k$ K4 ^}, n1 V" h" F& S
window.onload=populate: K; q. L% Z2 X, |# L
- H0 L. D6 M! u( R$ [6 q. Q5 g% p
function scrollmarquee(){
( ^& O8 }/ X* O6 Iif (iedom){9 o. y* K& f4 S. b; B U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- ?% t0 O; I" J4 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* y* N) r! L) \, l6 H" F3 i- N4 w
else8 r T* R4 Y/ n& d; o Z
cross_marquee.style.left=marqueewidth+88 ]" B6 o# ~; G8 l( [8 A3 T* U9 w
, v2 f i0 O1 }: u& v1 Z}
/ I. m1 L. z4 I+ velse if (document.layers){5 L {! U c) r7 s; I* n# b
if (ns_marquee.left>(actualwidth*(-1)+8)): A3 k, N9 z3 z' [: ^1 C
ns_marquee.left-=copyspeed
9 E, b1 W6 @2 P; n0 |' d* Z( e; jelse: z2 \9 A% m# r
ns_marquee.left=marqueewidth+8
Z' d+ I e: k# {& g4 ]}. y6 P1 _7 _0 P6 ?4 O, e. B
}
; ^5 L3 f- u4 P6 A4 `; l0 n, R8 Q) w7 C- O0 w0 ]
if (iedom||document.layers){
2 ~3 k$ W3 V' M! @# H9 H3 O9 iwith (document){
" X# ?% \3 ]# y3 C* qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* T" [$ y0 J+ _ \" tif (iedom){
3 h% Z$ i6 _% b( M9 L/ uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 `$ @4 c9 J+ W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' _0 b0 P) K5 Y& }, _. e! {! [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* C/ A0 u2 L4 fwrite('</div>')
: C" v% h9 ^, J5 Y0 K0 O- F}3 _- d" {/ c2 E0 O- ^
else if (document.layers){& M1 E3 t1 n/ m7 s$ f6 k! i& P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ P! S, I% O7 i. fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 P: X$ m* ]" iwrite('</ilayer>'); j1 t6 O! [# l/ @: ^9 q
}( }. ]% ^3 |! W# Z) z3 N5 E
document.write('</td></table>') |7 O/ U4 u9 b: S3 I
}
/ i3 C9 F5 M2 N2 q; Q7 Y( A}
3 ?) ?4 \6 r% a# Q) N% z</script> |
|