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

|
网页之跑马灯文字特效
//修改宽度( V! P8 k0 L* k
var marqueewidth=300
) ~. h5 K* j p0 u+ s1 M! T//高度
2 S' b, C5 a$ w% [1 uvar marqueeheight=25
, C/ }* T e6 m0 D- ^) B//速度(1-10); ?3 M2 w/ R; h; b2 k) @0 b
var marqueespeed=3
* \4 ~) t0 y+ L/ b6 d5 w/ k/ ~( d//背景颜色
7 p; p/ ?! t" lvar marqueebgcolor="#FFFFFF"8 T# H" h6 y3 O9 j# b$ K
//是否能暂停 (0=no. 1=yes)?
3 ]& k; L7 J* c9 c8 c# E3 Z6 zvar pauseit=1. u/ I; u2 y/ G8 Q' r8 k
" y" C3 P" k: h% X! z' _. Z//修改显示内容6 b- r e" Q) e$ c6 s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 w# _/ j: w# H0 H- o' a5 E4 ?" J4 G. f! d: e0 R
! W0 D, h0 L; @/ \2 i////下面不需改变////////////
% e/ z, b7 B( G7 o: h0 m7 t, t$ r
' a, o/ l0 F) ^& uvar copyspeed=marqueespeed
" Y: B) N* M; o& jvar pausespeed=(pauseit==0)? copyspeed: 0
7 ?" h1 ^- |7 k5 U5 K p8 o9 }) Dvar iedom=document.all||document.getElementById
2 B) f5 M& I$ M) a1 k2 }+ B0 }if (iedom)
2 i: t- X% P( n' d9 E) o& hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 m' _# P4 M+ F5 O' r1 {3 `
var actualwidth=''
# K) l, B0 B; t$ Qvar cross_marquee, ns_marquee
& W5 ^) C: K. W5 K" Q8 I) C; r/ r8 }" | N, M: f0 ?
function populate(){7 {5 i/ n* D, X9 r6 r% a: K. U8 k' K
if (iedom){
. ^' j' O& A5 \# U- zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 s. z% y v' |) m, v* t2 Jcross_marquee.style.left=marqueewidth+87 n t3 R; L7 ` S
cross_marquee.innerHTML=marqueecontent
* `9 v! N1 c( v6 K. E% D$ ~+ pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, E1 k% ~5 ?; E6 q: q) K% h}
T9 v: |- D- T2 i9 S; celse if (document.layers){: q/ P. \) X4 Q% b t# u: R) ^# T
ns_marquee=document.ns_marquee.document.ns_marquee20 P! ^# { L" j9 g5 G
ns_marquee.left=marqueewidth+8
: P" G- ?" {8 r6 r( i5 P- d) M- |ns_marquee.document.write(marqueecontent)
% j2 g8 w4 `7 x; ^# x) [3 f/ U$ nns_marquee.document.close()
" f( x7 I1 m) Z1 ^! xactualwidth=ns_marquee.document.width
4 N% O+ T, }6 n# S}
% W" N: p9 }* D" elefttime=setInterval("scrollmarquee()",20)0 \( W3 Q L8 |0 [* A3 |/ d
}
& I- M8 H @+ }window.onload=populate* x! \- E" ?, I5 f- J; _
- A% p/ e" i+ u- D5 \& X( n' m2 s
function scrollmarquee(){1 V6 I5 G; P9 ]/ |: e1 @, z
if (iedom){
7 p) j' Y2 M2 D2 R: S* I$ c% i! Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) H6 e* Z3 G0 q( h) C1 y& v9 f8 Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' q! k# O: g! K- E ]; s5 U! x) eelse
6 n u3 v, u1 F' K# k& lcross_marquee.style.left=marqueewidth+81 L+ O" t3 V) B, G
$ t3 h3 H+ T* P( H
}
7 H5 K4 W) [- U/ \" P" r5 Zelse if (document.layers){
' x5 G; m; g0 Q; Dif (ns_marquee.left>(actualwidth*(-1)+8))
. U- _, n! Z4 fns_marquee.left-=copyspeed% r: ]9 q% I2 H0 b9 W% v5 q
else
9 b& O( G) e$ \7 O. gns_marquee.left=marqueewidth+8
- {* ^+ P- |& s* C}
0 y: E7 K6 B6 O$ ]}% @" A6 M& h* R* ]
* w& _0 C9 ^/ S% @) N. j5 K0 r) |$ Nif (iedom||document.layers){
4 \" [! m! `% m4 `! X, C4 Rwith (document){4 m6 h7 H5 u. s5 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) ~0 F, n, o+ y. l+ u3 u0 h7 Qif (iedom){
+ j4 P- o/ O$ P4 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( ]+ D( p8 I: S% R ^* B3 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ @" v n4 \$ T/ F, U( Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" a* W- l8 i5 t7 B$ C# g# o+ A
write('</div>') ]+ ]6 y' \4 F, N6 q
}
* O0 s! k, S4 \3 a; k% Belse if (document.layers){% |0 o# J) e, x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* V$ G" l- ~3 J! x6 F7 c+ _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# n( O. q8 b! P) y I6 W3 J! Uwrite('</ilayer>')* s. e4 G* [- a5 E
}% u0 Y5 m1 c2 `
document.write('</td></table>')
0 T; w# w+ j" i5 [7 {) f: P}
5 J! Y$ G' Y( W9 p% g}
( }1 P9 L7 c; N" p</script> |
|