返回列表 发帖

网页之跑马灯文字特效

//修改宽度- x+ {0 ?. }( E5 D
var marqueewidth=300, g  k: v9 e! K1 l) R3 W
//高度
* g: s* F* B5 jvar marqueeheight=25  R- g' Z. S, c
//速度(1-10)6 W( p+ o7 `" O  a
var marqueespeed=38 d, p3 V/ a6 K) j) X2 P* W
//背景颜色
8 r3 C2 p9 ~$ v2 A3 ^var marqueebgcolor="#FFFFFF"
$ H3 Z, @! V# l1 Y) R' k//是否能暂停 (0=no. 1=yes)?+ }. J$ P. O/ t! f
var pauseit=12 \5 M4 k9 R# m% K
. y0 C' C% }* f4 d
//修改显示内容! m( b9 B% F  s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 V5 r9 V, A% H; `1 N6 o( j
0 q8 j7 j$ H, i% Y$ }
# @1 X* b: ^% J; M( `8 j. V' }
////下面不需改变////////////
/ G- r4 w4 o1 k# o: F2 Q5 c1 h5 v! m8 n0 a
var copyspeed=marqueespeed
, c3 W2 V0 }7 x3 I; H0 ?var pausespeed=(pauseit==0)? copyspeed: 0
; t% |* ^, v' D7 s3 avar iedom=document.all||document.getElementById
, m* Q" f# x) C1 W5 kif (iedom)8 g3 p1 c3 `  v2 W2 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# j9 }# u) ?$ ]4 Hvar actualwidth=''+ S! k  n4 W; @2 ?; v
var cross_marquee, ns_marquee6 A# _2 C/ _  N2 O2 G* d' l

1 ~% d: F' f1 O% Zfunction populate(){  t: N, G, N- V6 {1 w9 T- A
if (iedom){* i/ L, c7 C: ~9 w" s1 r0 L; N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- f+ a% p$ p7 b7 _" t* gcross_marquee.style.left=marqueewidth+81 ~6 p9 j+ K6 T
cross_marquee.innerHTML=marqueecontent
+ S( o; d* S- P7 b, b. factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( n9 D/ \9 F. h
}
7 w" E$ W5 O" D5 ~+ uelse if (document.layers){7 F& }8 T+ e6 l2 `! m# N5 ]
ns_marquee=document.ns_marquee.document.ns_marquee2  b1 }* p* O5 ^3 B
ns_marquee.left=marqueewidth+8
3 a. k2 G1 m; z* g  }2 U) m, O0 vns_marquee.document.write(marqueecontent)
' G; r/ r3 G5 T2 d; Sns_marquee.document.close()7 b1 [* t0 q4 x3 H! t
actualwidth=ns_marquee.document.width
! Z5 p  ]+ x( ^  f1 O: o: v}. `5 R# {8 X( m3 }; g, b. i' X  ^. _6 n
lefttime=setInterval("scrollmarquee()",20)
) [( s* u- ]8 S/ u+ j+ w, J5 F}
4 e  Y. T- ]5 K7 bwindow.onload=populate
$ z! y; M$ i/ {0 y2 w( c$ {* U; C% R; e3 T
function scrollmarquee(){9 ^! |! M% U! L$ d4 o$ e& O
if (iedom){
- I1 t' t; ]2 M. P) d! c; J1 ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 S, R' B# ]" d8 {' h9 Q. u# v" lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% ^& t: }* Z( b% o+ Lelse
7 b5 Z% v! N# I* u- K: ocross_marquee.style.left=marqueewidth+8+ s4 |0 _# y4 o
' `9 i) s9 p* M: p# ~/ N; L
}2 ^6 i, o' z- E% }  N( l- a: g2 z
else if (document.layers){* b9 ~0 r, X/ ^: Q  A: z" g
if (ns_marquee.left>(actualwidth*(-1)+8))1 c0 u2 i1 ], I) Y; I# r' n7 q% o8 C; F
ns_marquee.left-=copyspeed# [( k; b' U2 ]( a
else
, y6 q: u. Z2 T3 u4 Wns_marquee.left=marqueewidth+8) l- v2 g6 W: [
}
+ w  y& c; c0 p3 h}
! u' ?0 O" A, p' P' H" {$ e+ l; }4 O# e+ s
if (iedom||document.layers){; e* {4 w( _8 E  V
with (document){8 Y( [- g3 o3 A) R6 q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  B2 D9 {% X/ t0 a
if (iedom){
: Q9 E% `- R8 W& m/ @+ V5 g5 j: nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 H+ w2 Y- }4 F+ Z/ L) c1 q6 b6 x- Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 p5 z9 S6 V( I! O: D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), y. {- K) h" f6 ~
write('</div>')! Q: [9 |' z% }9 E9 [
}- {+ \% I' n5 _3 x- ^/ H2 P
else if (document.layers){
; \! e+ @7 Q) F$ q( Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 Y; q) c$ a" R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( G7 i6 S& H9 c8 E
write('</ilayer>')# s9 ^% w( b+ [6 K% O) Z+ }
}9 O0 Q6 W- T8 N0 @- R% g' [/ w0 C
document.write('</td></table>')
5 D' I& I+ W# g4 e8 a  C: h}
/ P8 z8 ]: r& U; o3 n}9 q9 }) }# a0 m, V! y: p& _
</script>

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