返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 t# Z- c$ |* K1 j
var marqueewidth=300
1 _, n: r# ~, w  r4 Y3 E8 C) V0 F//高度
9 T! V7 p+ V* _' g* evar marqueeheight=25
/ d: ]' D1 \* L# z- o& X" p//速度(1-10)
' z, }# t4 ^. g8 Q5 ?% p  yvar marqueespeed=3) Z. X" L4 k3 `$ R- [5 e- u
//背景颜色
. D: T/ V- b3 c, _var marqueebgcolor="#FFFFFF"5 S9 |! ~  v" v2 B
//是否能暂停 (0=no. 1=yes)?
/ t' ^& Y; ]" P4 Y7 O) \8 Dvar pauseit=1! }" V' Y; Q. ~! P

! m1 V: h( S1 @3 o# k$ \//修改显示内容! i  }( i0 q6 }! [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 X# o' t8 e- g+ n2 F' F% n
+ R$ @' r0 Z" x8 N8 D9 F, ]9 e% f
////下面不需改变////////////
9 w' O2 F" y9 R
" m3 f! |- f, B) Uvar copyspeed=marqueespeed7 j: H% _- D1 m' s* H' X
var pausespeed=(pauseit==0)? copyspeed: 0
1 `6 R( g% z/ C0 `! t# e4 X; @( Zvar iedom=document.all||document.getElementById
7 R6 G3 W" W: |8 n0 lif (iedom)
& ]  M1 c( {( n% idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ A' ?% D  c; [var actualwidth=''7 f2 m7 I( ^: F) f
var cross_marquee, ns_marquee
( R' v7 k- N( S/ n) G/ A6 J! B1 W% h5 n5 H% o
function populate(){
6 N- N; e" q( {3 Dif (iedom){
$ |. Z( u' l" ?  [6 c4 |& ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( z3 Y# W. S2 K4 ?2 l& Z* ?cross_marquee.style.left=marqueewidth+8
* m% P5 c( Y. M& E& O8 \cross_marquee.innerHTML=marqueecontent
- b* U) ^* F) d! B/ `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. U; s- E8 o( g, `, |6 c}. P( r1 n" `* }  |7 s, A6 f' s
else if (document.layers){5 Z& Y/ D6 R* U/ Z+ H' D
ns_marquee=document.ns_marquee.document.ns_marquee2+ F0 D7 K6 i; J! ], x5 n
ns_marquee.left=marqueewidth+8% _% p$ \0 d0 h) x! z: K0 M* G) H
ns_marquee.document.write(marqueecontent)
) _' I: C8 }" f# Ans_marquee.document.close()( a. v& |7 B4 N, y& A
actualwidth=ns_marquee.document.width8 {, s  n6 d8 a; T3 T2 Y
}
( j. _* z/ {* ilefttime=setInterval("scrollmarquee()",20)
' E" \3 |' `8 m* V, a}2 _' T* g. ^4 U
window.onload=populate
2 A- J" I  M, S+ X& d
' x" T5 ^& C  ffunction scrollmarquee(){+ z4 i% V" ~8 b7 e0 b
if (iedom){2 y; X8 C( W+ Z' x* h: z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 G  ^: u# w6 ]9 K' h1 C3 E* ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 H: ~' c6 [, n" Y" }. p8 G3 i1 N
else
4 A" B) [2 S3 v- {. P& }& j/ A% Scross_marquee.style.left=marqueewidth+8
; n) `* ~% |8 ]1 v6 ]$ R, \6 H& P6 S3 C% m: V8 r7 m
}
$ w1 J# N+ M% Eelse if (document.layers){
5 ]6 n+ F5 X% i3 cif (ns_marquee.left>(actualwidth*(-1)+8))8 x' o" r3 e1 \1 ^0 z
ns_marquee.left-=copyspeed
1 S3 y: g1 A; p6 a$ v! K% n$ _else; F8 Y- O  u& R4 o2 z5 I
ns_marquee.left=marqueewidth+80 F# {' p+ m3 v, x0 y* v
}
/ D. Q% v- Q+ g' e; p, K}' K7 U: \% P/ F0 x" i. m  H
: k$ D* h, f1 o3 B* G
if (iedom||document.layers){
) T& g+ i3 s6 V7 [with (document){
# ~( g2 u! S' G2 c& f4 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 }" k- P/ o- w$ N- g/ u, J3 `if (iedom){
0 p/ H: d8 b2 Z4 f# P0 n* F5 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 M% g6 a  p. d9 o2 B$ E) D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: |$ n- b; I3 u+ ?; awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 s2 i  ~" V+ b4 G2 e  h  ywrite('</div>'); h1 H  H6 w5 f5 u9 m
}: ]3 K# `  w$ h/ W' G$ V
else if (document.layers){$ X1 ~1 D/ s9 V( m4 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 r( Y- q/ ?* iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 I6 U2 I% N; H
write('</ilayer>')' }- h* z1 j! p! `7 m) Y
}/ ]7 q9 V' w0 j# e% o, J
document.write('</td></table>')) N) _# h% \$ Y3 q# s
}3 W5 w- x5 a. h; U+ @* Z5 P$ Q+ R
}
- W. H  K  {' m7 P! A3 }6 f</script>

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