返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 p) H4 w( {: C( k' ^var marqueewidth=300
8 B7 c$ A! T0 r$ E9 ^/ j//高度
: a+ y. s1 E1 r7 j$ Y1 yvar marqueeheight=25" b& x7 S  v% |
//速度(1-10)
. K+ o# t% J$ h+ ~var marqueespeed=33 ~8 N4 }0 b" B; z% B( g
//背景颜色
$ {4 E& K7 H+ c4 Jvar marqueebgcolor="#FFFFFF"
& ^. g/ Y, ~, b# D$ g1 i//是否能暂停 (0=no. 1=yes)?
& E+ _* _5 F& O9 O: H! H9 s- Cvar pauseit=1
8 t& N. z6 [9 [  }; K; M( q, U# q2 y! B9 h' N" U' k$ f
//修改显示内容  t4 [5 g* `$ x( ~+ i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 j  `) m( o, _7 ?! Q( n
( P1 n$ T, w; }
' ]+ [& e( p7 O8 g% |( ]7 h7 L
////下面不需改变////////////
9 K7 K/ r2 w0 ^* x7 A5 i
5 G& J' r. `+ Dvar copyspeed=marqueespeed
) x/ W7 A6 `* M! M1 Jvar pausespeed=(pauseit==0)? copyspeed: 0& x8 `$ x% P. o8 i, B' j$ R
var iedom=document.all||document.getElementById3 N7 ^+ F8 W$ }- e4 p! j
if (iedom)
) t: u0 U* }  H5 _$ v+ O% V, Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; x- @) R. x. @2 ]var actualwidth=''
& a# t) p. W9 ivar cross_marquee, ns_marquee# }% O( R0 F* F, r9 i
5 x) `; C! P1 P( }& i. \6 y. q8 x
function populate(){% ?1 q. N3 p, J! ?. O; d0 z
if (iedom){
5 v7 w1 K( S! K9 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ o8 ~% B+ E0 v& O$ G
cross_marquee.style.left=marqueewidth+8
- |* _7 Y" L9 P0 x5 t* K( i' e: ecross_marquee.innerHTML=marqueecontent
$ R7 a( d! O% x  ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 i; s4 Y' [8 Y) |& _" p" s5 }
}5 ?' |6 Q! K6 |8 ]0 ^. R% I
else if (document.layers){$ \9 D/ \) _4 w4 {" K4 l
ns_marquee=document.ns_marquee.document.ns_marquee2
( j1 u3 j, u) i+ E1 `  d) H9 Ins_marquee.left=marqueewidth+8
: G! Z8 I% V0 A, W  S) F5 Jns_marquee.document.write(marqueecontent)
+ g8 j) o/ `6 Y" o. Y; ?ns_marquee.document.close()8 X3 i) g% W+ f
actualwidth=ns_marquee.document.width
: s  \1 X! a4 c( M}
% k5 p& S9 A: w  M4 z4 |; Vlefttime=setInterval("scrollmarquee()",20)
5 }5 b& e5 v0 d+ G6 ~4 S}
* m1 @3 g( b& c# y" G, @, wwindow.onload=populate
8 p% _: `% k) o" P# i% r% A* }; e5 Z" `  ^; s: P% a; l
function scrollmarquee(){
; S! k: h* y/ ]8 W# x9 _if (iedom){
* B& t4 m3 O$ X5 h4 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* D7 l- b, U1 k: ~4 E& ?* a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* `- m1 v" A6 I* {
else
. l0 T4 @' m* n: n! f$ P% d* Xcross_marquee.style.left=marqueewidth+8
, I+ Z  ?. ]7 O- A
7 J. c+ }: p, _" E3 u" y  D* \7 P}3 j9 H6 I2 K/ o( n" f" T. w
else if (document.layers){
3 R& q; [# S) U3 Y+ L* Eif (ns_marquee.left>(actualwidth*(-1)+8))
* @' p5 _- M) |+ h, qns_marquee.left-=copyspeed
2 z1 m5 G$ e" u: ?2 selse: Y2 @6 l! x) T& v3 C* @
ns_marquee.left=marqueewidth+8
: P- F4 q2 t* _4 t7 A+ W}6 r8 L, z2 }* Z- W$ _! V
}3 i. ~7 P1 {# l% c& h4 q" q# R

/ x) O6 V0 f: S6 W" u, g* Lif (iedom||document.layers){
& h% f7 ^" K* ^% x+ f. ]. [, fwith (document){9 D" O4 }5 y' R* {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. G5 w0 N# n# @# J1 ^8 eif (iedom){; y7 u1 w2 @2 z0 K) o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 L. ^: t  y) J- R) z1 t; `5 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). l3 x( c; T+ f% Y2 g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 p# J6 E- w+ Q, {5 e: ~: _& Gwrite('</div>')  m6 U7 c4 X1 d, K; X
}9 m9 y3 `% D# _" z
else if (document.layers){' n2 ~5 D9 _  ^) ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ k' j9 P% O. }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ f0 O6 Z+ D% t" {4 X2 zwrite('</ilayer>')
+ @3 ~" x; M8 F( ~* h9 C}
7 P/ W. ^( p' bdocument.write('</td></table>'): P6 i6 M& R. Q) l
}2 ?9 \/ a! i) v- m
}
, A4 n" z# b$ F- |5 p1 ~9 u</script>

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