返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 I/ f4 p  j& F2 zvar marqueewidth=300
& q- [" a4 d5 R) s5 P8 q//高度
& x1 p2 {& q5 a1 b8 |1 jvar marqueeheight=25
% x, E( L; J+ o8 a7 F//速度(1-10)
: e5 |4 u! C/ O' i2 H4 tvar marqueespeed=3
) X( h2 l( y4 C' P//背景颜色, R& d+ G% r8 {1 N% D, j
var marqueebgcolor="#FFFFFF"' b  y1 j5 U) _) m' E: g0 {
//是否能暂停 (0=no. 1=yes)?: d/ T! Z# |4 x  l
var pauseit=1
" m" D% m3 U) g1 k3 c; R
% u& W/ b  v# y+ f0 W3 k( N5 \//修改显示内容
7 k6 v+ a6 g7 r0 A+ v" T4 m/ U* g6 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': F. b; x! h$ q" z1 X5 v
/ b: }9 p. L: t* k

$ f$ e* x8 c  u////下面不需改变////////////  l: C( l) c! E9 ^
) g2 W9 m8 ]& g7 m% }- d4 ]
var copyspeed=marqueespeed
: x6 j0 Z; D& o) M. B! Ovar pausespeed=(pauseit==0)? copyspeed: 02 |8 f9 x4 g- B$ s* ?
var iedom=document.all||document.getElementById' V7 h1 d; F5 P8 L  ]
if (iedom)
+ g+ G- e: I$ U; M3 `! s6 I+ Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  P- s: b  h1 e
var actualwidth=''! ^, I) m/ Q4 q! a4 s
var cross_marquee, ns_marquee; w) k" W) u2 O

; k% U5 v+ i1 E5 ?function populate(){
1 m4 E0 I  t- x, H* Iif (iedom){+ h7 V' R0 ]" N  f5 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 m$ W+ E4 }' `2 b4 T2 {/ r5 ecross_marquee.style.left=marqueewidth+8
+ K7 |( S1 d; x. [' _- ~3 H" |cross_marquee.innerHTML=marqueecontent
- m# t  k$ n3 zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 i0 w% ]) k8 c2 r+ `& G' N}9 x3 r( c& b( O+ E
else if (document.layers){
  t8 w! H7 x: Z4 y: C% pns_marquee=document.ns_marquee.document.ns_marquee24 p5 E& G* S! J: i' z
ns_marquee.left=marqueewidth+8
! \2 o9 g( v0 ans_marquee.document.write(marqueecontent)3 [7 q& e2 h. l& ?0 M
ns_marquee.document.close()( i! Z, \+ \& E/ l- a/ K5 j
actualwidth=ns_marquee.document.width# a% k! \& S" Y3 E
}( i  T% c9 Y2 R) @
lefttime=setInterval("scrollmarquee()",20)
/ a3 {; G/ |* ^7 _) o5 h}1 E# X. ]0 G* g% d+ u
window.onload=populate
! t; m) m' q. k1 Z6 \
7 _* V0 u0 |) D2 ufunction scrollmarquee(){6 H( y& L- a& M
if (iedom){
& b  O* U4 H( g$ Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% c! t6 e7 U$ N3 a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* o- Z6 q+ M7 O9 A) ?
else
2 Z$ D7 t3 g6 Gcross_marquee.style.left=marqueewidth+8
1 n2 M- l$ n5 z% {+ r9 k, Q: U
/ w; |: [; ?# Q* y% m% `  I}
- Z: `7 e+ \8 }' Uelse if (document.layers){
& o5 t! w% w5 c! [) wif (ns_marquee.left>(actualwidth*(-1)+8))
1 E9 T, Z3 J1 T% E0 N9 qns_marquee.left-=copyspeed
7 e: h; b' L! e+ R0 Qelse
2 ?+ n, U& t3 `ns_marquee.left=marqueewidth+8% H/ q8 G1 S! T% z0 p* q* |; ^
}& ]; V1 ~5 L$ Q
}
% o: ?: L: s8 l  Y& N, f" K! U9 w% f9 A  L& w' Q! T7 T
if (iedom||document.layers){
$ i! E4 B" X  `. O6 G+ zwith (document){& x5 }: D3 V: D2 ~% R  X9 ?  [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& R5 d9 \3 x. H) k# D& r
if (iedom){
6 B, m/ r& h- I# l3 z0 O" iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); b+ R/ W9 W0 A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, ?9 p+ \8 G* bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& a* O0 I& X7 M' y( Qwrite('</div>')0 g& h/ s* R2 C  `
}
& D  T; G! w9 aelse if (document.layers){
  X3 I& o2 M3 Q; Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ s  y6 u6 O0 ~' C8 w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" E7 U% A! Z& D* V3 n) P  \
write('</ilayer>')
/ b: i0 I! B* A( G+ O}7 F9 D  h' ]7 U9 A7 R5 A0 Y; r! V
document.write('</td></table>')! ^" D$ y) d1 B' p$ i
}0 a' j" [, [# w) N2 E' ]9 J
}
. J  L0 s" d  n( C# z</script>

返回列表
【捌玖网络】已经运行: