返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 |& V  z7 D3 Z1 Z2 t
var marqueewidth=300, u" ?* z. X( @- C& _
//高度5 H: m* x6 x& U2 U2 {7 J% ?
var marqueeheight=25& O. T' ?& z% x% V
//速度(1-10)& T; u% j8 S/ L# J) c" H
var marqueespeed=3
( \; o3 ?3 O& p//背景颜色, b$ g# G' ~" X+ A" x2 I4 V2 X
var marqueebgcolor="#FFFFFF"
' N, R* m# U- B0 ^//是否能暂停 (0=no. 1=yes)?$ J) Z3 R0 v4 j' G6 `/ ]
var pauseit=11 i8 r5 w  C$ G1 Q3 s

4 P  @& ~- {- X. @9 X7 _//修改显示内容3 q% Y5 \; h3 T* R* S/ }6 I. s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 [4 {* A  E! y# x3 L$ t0 V) _+ `$ l" B2 o8 C
5 c( ]7 x' u* j. J& L: @
////下面不需改变////////////
8 f5 j2 K2 h! W% o* R+ o0 A& M$ P* v( g, m5 J' q
var copyspeed=marqueespeed& r  `. I/ X% U, ~# Q1 h
var pausespeed=(pauseit==0)? copyspeed: 0
/ T+ b0 ]/ K: }5 Ivar iedom=document.all||document.getElementById
9 W0 k: J0 e2 C4 X" V6 Uif (iedom)8 b& [$ u9 [+ l6 ]9 e/ b# {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ N, c6 V( M& e2 P0 f
var actualwidth='') [; u9 a; |) M: h$ C
var cross_marquee, ns_marquee
+ d% _1 x/ w: S  b* @. o# D
* q8 ?- m! i( U0 nfunction populate(){) }; r8 v% L% B- E+ P9 q
if (iedom){
6 S+ A+ ?4 k2 f" s7 j1 J0 Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ O( \( y. U- u" A$ F
cross_marquee.style.left=marqueewidth+8: _. {' _. V, v. a% E' [
cross_marquee.innerHTML=marqueecontent2 k3 F" {) y6 c+ B: s2 S( _& k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 @, T3 z4 H. z0 J# t; s}0 s! H+ a  n1 E
else if (document.layers){
6 `1 b- _+ r. v  ?9 W( vns_marquee=document.ns_marquee.document.ns_marquee2* T. D* B6 Q1 b" v  w3 w
ns_marquee.left=marqueewidth+8+ A. N) G' V  g" G  @& s0 h( X4 f
ns_marquee.document.write(marqueecontent)
& ^6 p( k, n, {# Q" T, J0 zns_marquee.document.close()
- M& k% F9 H  e  X7 nactualwidth=ns_marquee.document.width
' o8 O$ G+ ^/ j}/ f" Y! g4 H. ?7 Z5 U
lefttime=setInterval("scrollmarquee()",20)
% T+ X. v6 U- d! D' D! P: Z}5 R+ ]; a1 }) W- ]/ I- q
window.onload=populate$ K; V8 }, m5 b/ C4 [
& |5 ^0 u6 {* F. I; O, W# w
function scrollmarquee(){
. y6 g7 _0 X+ z' [* u+ G9 tif (iedom){& w" Z( Q2 V! U6 h: m4 a& \, @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 Q: R3 A5 a8 y# G  e1 O7 p! _0 Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 R4 F" x8 X6 F! C9 C1 k# }+ t# }else3 O  i2 b8 h% B9 q) Z# Z* }3 ~
cross_marquee.style.left=marqueewidth+8: t" Z6 w2 f% p! h1 C

, C( _! Y+ z3 K}
4 n2 i7 b4 R% {2 t8 h- x" Kelse if (document.layers){
% q+ C" @2 R' f, ]8 gif (ns_marquee.left>(actualwidth*(-1)+8)), l, v0 }2 j. X: p: x2 J/ r
ns_marquee.left-=copyspeed9 m: n1 s# ~: y) P7 _
else1 {9 w" O; t2 y! h0 A
ns_marquee.left=marqueewidth+8
* R( ^( N# J% F) }% `}
3 w- T8 h/ P0 ^! b1 {& v2 C& }}
( ]( k' o7 u' b5 g# g- N  D1 x" E5 @1 Y- k
if (iedom||document.layers){7 u/ ]' X- c5 s) u) o0 H3 X- S  C
with (document){9 i# v0 p1 R" `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 ?/ H6 O8 A; V) P* }( }
if (iedom){- M3 Y. {+ d/ V- Y+ {, b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ w' x! b. Z1 d7 d* f* Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# r1 e& ~& v1 R9 r' @1 j9 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. X1 _5 l: t3 a# owrite('</div>')/ K1 R6 O  `3 D/ Q9 W8 Y9 i) ]
}
# Z; M0 G- t8 _! _7 \( Uelse if (document.layers){) f5 j3 |; @; a- \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ c3 J$ \# y% T$ j* ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# ?2 D. O- V4 Q/ V$ t% d4 \+ i* R
write('</ilayer>')
$ y  R. O9 h' _3 X- u+ C}" u$ O3 b$ B3 M; I  G
document.write('</td></table>')
/ l4 M3 e+ A/ o9 |& S}
0 E  ]6 Z* p/ Q' X; @+ P4 y}+ }, v6 B- i4 x/ B
</script>

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