返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# f; i$ p0 m& wvar marqueewidth=300
" e3 d' s. w, e: v. }//高度( W  a. q+ q. k; w* V9 x  ?
var marqueeheight=251 ^1 t# b7 |* w' s5 A
//速度(1-10); x8 [) r. k' B+ k9 d1 L! `
var marqueespeed=3! }1 o0 r' ]' b# h. ~
//背景颜色* G/ q6 @7 h) x" |! k" V
var marqueebgcolor="#FFFFFF"
. d9 a& H6 [+ g//是否能暂停 (0=no. 1=yes)?
8 s0 ]: b# T  x6 {) Zvar pauseit=1- m5 ^. ]; |. S/ y& J! t
, l7 ]- X; j( M/ Z: Q( q
//修改显示内容: s4 ?$ Z! P# B; ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" g5 Z7 J6 `4 ^% C- X2 a) }' O* i# Y8 [+ x+ }6 I0 H0 y- V

) S) m2 G7 h% f8 t! O////下面不需改变////////////, w+ ~/ V; k2 Z

" J, X3 s) e3 N8 I. Zvar copyspeed=marqueespeed
. @) x! Q9 m, l, v' g2 ^8 ?var pausespeed=(pauseit==0)? copyspeed: 00 l9 E. i, L) l1 x; }7 ~" L
var iedom=document.all||document.getElementById
8 ]: h  w7 g) `4 V& jif (iedom)
( R0 S" {$ R7 ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 r  x( N. A. j# U6 S
var actualwidth=''
& d$ p( G/ K% ~4 h+ tvar cross_marquee, ns_marquee
$ m7 l  f; H7 H+ i# w4 c# C/ @, g: M. d6 R4 a6 Z! l% `8 f
function populate(){. G% c( x, t: W! X, h
if (iedom){
/ p: X) X8 G/ Y5 w9 i5 P  E' w6 G9 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 g0 P* H" r4 I: A7 f& ?& D7 l3 l
cross_marquee.style.left=marqueewidth+80 @$ e' k8 J1 l4 j  H- h) r
cross_marquee.innerHTML=marqueecontent
5 B! @* V( X8 F% `  t% n* I, A; C6 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" s! ^# z' P: R3 H, Y' g/ g}' e$ r  ]* x, C6 g5 b
else if (document.layers){2 `9 V; O3 Q) @7 F9 A8 ^/ R
ns_marquee=document.ns_marquee.document.ns_marquee2
4 a; p+ [! K$ y$ l0 t: [ns_marquee.left=marqueewidth+8
. ~0 q- [6 Z: r- `' X+ R9 {6 rns_marquee.document.write(marqueecontent)
8 Z- d( b7 u4 D7 H7 y* cns_marquee.document.close()% z: t4 z' Y- L# Y% x
actualwidth=ns_marquee.document.width
2 M& W, o! E% _- W/ y" f}: e; j$ R6 x% _! S/ N
lefttime=setInterval("scrollmarquee()",20)' T! K9 x9 {$ N0 u6 k' ?5 b
}
, {0 z0 Z7 X; E1 ]: z% uwindow.onload=populate* X9 D/ A4 B: N6 w- ?4 _$ C/ s
  {& J- }) k7 \; |  w
function scrollmarquee(){$ w+ G: o( C  L& L7 h
if (iedom){0 D- t/ I* `7 z" W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 w$ c& Z+ J% Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: k$ K' `! @6 l' e- t/ i3 H; A
else- Y4 j! n6 L! \8 g: L) i
cross_marquee.style.left=marqueewidth+8
2 T  E- r$ Y/ O9 g2 g% J0 h. A9 Y: @. }" W* {6 @
}
% h) h% t; ^+ u; d* `else if (document.layers){- B1 p; n, v$ X4 W4 ?% D
if (ns_marquee.left>(actualwidth*(-1)+8))
( e5 f- @" b! l0 ]) n3 Ons_marquee.left-=copyspeed
8 V+ ~+ T/ D" C' J# n2 delse
! U2 M  y0 i8 j7 g6 pns_marquee.left=marqueewidth+8; ?- R6 c, t' x* J; d9 f
}8 V3 s. [0 O! a7 a2 b
}$ c! ~. B+ x5 I8 g

. X8 h  T; r: |! C" q# n% Kif (iedom||document.layers){
2 Q& H2 Y: U# o. F2 J6 Jwith (document){
( m+ I, v- H' x6 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ g; T7 K! ]% T' Y+ y  I8 Fif (iedom){
2 G- Y/ a9 Y4 ~0 Y8 U- |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& S% h0 h1 Y$ o( r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). E! e0 ?& K3 M* t) B- R* G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 ~6 ?( H% q5 h8 Y" f9 C$ r; C) D
write('</div>')% m) F: Y/ P& E" m/ [
}9 J3 z( ]( J& m* s, \
else if (document.layers){$ W. E. ~: Q3 j6 [4 M4 ^# X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): t5 y5 _  b; ?3 K1 {2 R. e; e; i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* ?" e7 z+ ~% _& X! v! ^& \
write('</ilayer>')  N. U* P( p- H/ G& U) v9 ^
}  F+ u5 x: L0 Y' u3 x. r6 _
document.write('</td></table>')! J5 l1 A3 @7 i$ }1 _
}
6 |6 F; E) r( @$ a}
2 E' L4 T6 @2 y% x</script>

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