返回列表 发帖

网页之跑马灯文字特效

//修改宽度# s5 N9 y+ N) `( J/ @& H# d: d
var marqueewidth=300
' Y1 w- \4 V/ g" F0 ]3 e7 u//高度& B5 @+ d4 J: j. _' N
var marqueeheight=25
; l1 _% Y- @; O- K6 N( c//速度(1-10)
2 X! S9 v+ Q, `( Lvar marqueespeed=3; b& V! Z) a+ s4 H- ]
//背景颜色9 F6 E* D& X# y# `8 `) k1 ~1 w4 p# M  j
var marqueebgcolor="#FFFFFF"
0 E5 f# w0 A4 x5 I: ^. t; ?//是否能暂停 (0=no. 1=yes)?  c8 K5 Q* _4 p
var pauseit=1. ^# N4 Q* u4 v- ~' ^
/ M' w: e3 ~) X7 B+ x0 E, Z7 R' R
//修改显示内容! z! W+ m  l" c% B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- v5 v' Y$ {9 A

( _# w1 q1 m3 Q4 {9 Z
3 D4 \( i3 j# k- T# H////下面不需改变////////////
3 j$ u, i0 V& u# |" s5 o" e
' ~+ w  W, |% c6 b* evar copyspeed=marqueespeed
; v9 L# Y% Z3 ^var pausespeed=(pauseit==0)? copyspeed: 0* D$ b, q! f" t  p
var iedom=document.all||document.getElementById
) a  E% \' w3 Y$ z$ C- r( s" mif (iedom)
9 y; u( @* ^% f7 z* h2 _1 |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 W7 ~$ }5 r, o/ R3 N7 Ivar actualwidth=''
3 Q) j) S: }: F+ Cvar cross_marquee, ns_marquee
- K% r* P/ z5 _! t+ H
& ]6 |  a. C' d! t+ k7 d* Ffunction populate(){/ s) u5 E' W, [: ]# ?) k
if (iedom){
) |8 ?' T0 m  I* Z! r& kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* n! D8 ^* p2 R6 u$ T3 e& \+ icross_marquee.style.left=marqueewidth+83 R4 `+ b6 t" k
cross_marquee.innerHTML=marqueecontent8 W, Q0 P- j4 _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! G6 a- X+ |6 c, ~}
2 ^' _8 @$ W& delse if (document.layers){
4 i/ g2 ^$ Y/ q% c: D5 ?6 b7 B" \& Yns_marquee=document.ns_marquee.document.ns_marquee2
' c. l  k% S( }$ Y* k, I2 xns_marquee.left=marqueewidth+8
8 \' L4 t- n2 ?% h; U3 Hns_marquee.document.write(marqueecontent)$ L: C4 G! S  \* y' i
ns_marquee.document.close()
& R; }8 [; K" j( h- K+ z3 ?actualwidth=ns_marquee.document.width, l5 u, g1 _5 |3 I$ }$ X* G
}
3 I( h' G; r3 G* u3 ilefttime=setInterval("scrollmarquee()",20)
* l; A9 n0 M7 @}5 {% X% h; e: Z4 ~* Q0 j
window.onload=populate
9 H, l. V2 M! r: D
  P7 F$ H1 m/ V% m" {9 m' ]" a' yfunction scrollmarquee(){: F" Z9 M' b+ q7 B' ]. B
if (iedom){
, D2 G- G& w/ u6 Y. vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" ?3 o9 @5 ^, r4 V" b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. i; [  e1 z" l$ J
else8 h, F% A  F' k; n3 o% J, E
cross_marquee.style.left=marqueewidth+8# Y  k& p+ A7 }2 O; o- Q! e! F

5 I, M, s9 }% _- X  d}/ B: p7 w8 L/ m9 @( z
else if (document.layers){% {! P! n' m$ J, [% K# S
if (ns_marquee.left>(actualwidth*(-1)+8))( b5 ^. k; ^4 z2 F' i4 v. Y
ns_marquee.left-=copyspeed( }( d7 @4 w: ?) k4 E8 ]
else$ F/ k+ e7 t+ f7 g9 G3 n- c
ns_marquee.left=marqueewidth+8% W& q) |& Y8 W; c/ ]+ X& V
}& ]0 Z3 ~7 ?9 Y" W: D- @
}3 b# K/ J% F& q5 F4 J) h

' F2 \4 N% C- v6 m% m! U" @if (iedom||document.layers){
7 b5 ~6 \9 [4 H) `: Owith (document){
5 p6 {+ E; f2 H* @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 Z' }. n9 K: C8 Y8 ~6 k' q
if (iedom){
4 K. B' X9 W0 q) D' H7 J( z1 K* A  Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% H  c% \0 S$ o5 @  Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 g" e  _) P* ^' E5 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' a- ?: e3 c! ]1 g1 i' `; g1 Gwrite('</div>')9 z/ L* }3 N& J4 L& I. m0 E$ T
}
( K0 S8 B$ B' z7 `: uelse if (document.layers){
$ R. c! k0 G. @+ S! b+ b& p* swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' |0 ~. E7 ]- @8 j9 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" g0 ?& _# D* F' k9 ?/ y6 E+ d
write('</ilayer>')( _& ^) J2 A$ V7 A# r
}
1 F# J) b- y9 P* Q* ~* qdocument.write('</td></table>')) P% S1 P! V6 S
}* L% I6 f  a" D& I6 ]
}
) g, v' M% F" A& U) X</script>

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