返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& u) J6 O/ W4 e( {var marqueewidth=300
. O7 w" p( }1 l5 Q//高度
1 D0 O5 P. v% }, t7 w3 a! Zvar marqueeheight=25
" r( y1 v5 G$ V! H2 {9 K9 a- ?//速度(1-10)
2 O4 i3 u2 x4 i, m+ h2 Z6 uvar marqueespeed=3
/ P1 n+ y7 G1 N8 t) C( Q//背景颜色
$ m9 p9 C$ }9 w# u, e2 avar marqueebgcolor="#FFFFFF"
; C) Z1 V3 I3 n! I" B0 w9 \//是否能暂停 (0=no. 1=yes)?) d) U" `1 }  y9 Q3 X
var pauseit=1
, \* ~6 i. `, ]) N
1 ]2 q8 E" |8 |& z- n4 Y//修改显示内容
, \0 f+ Z7 A, Y; s4 |3 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 O6 f2 o4 q  N( w# o, _7 m
' G" e" g, c/ Q7 y

: x# z! |" p) o7 [( m1 Z3 P////下面不需改变////////////) Q  T& \% l! U9 y( a1 X/ ~, Z3 f

) C1 W' e" k+ |' C8 o0 u2 y! W7 ?" x$ \var copyspeed=marqueespeed; `5 l. @- K1 s0 N% ~/ y, w  B
var pausespeed=(pauseit==0)? copyspeed: 0
6 w0 L; q" _* g( tvar iedom=document.all||document.getElementById
4 X1 r! O1 o) Q' s$ Qif (iedom)8 K: P4 K2 U  W) M( v( R1 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# z; @/ a. h# {+ L5 \: qvar actualwidth=''% Z8 Q/ d: f5 Y) h$ _1 Y7 z
var cross_marquee, ns_marquee
- X9 B# _, D4 P( R" W! o+ ^
9 Z# u" P$ D5 r6 L" d3 H5 x1 p  c: ~, jfunction populate(){
) G7 A& ^* m+ k; c4 q$ Nif (iedom){
7 m$ V- f: X& S& ?: qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( t& p8 G. h" bcross_marquee.style.left=marqueewidth+8
* U4 {- C7 k6 ~% T- {cross_marquee.innerHTML=marqueecontent
, u" n2 N) y; d) P3 M: R& `' vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, l; d: V; W% _; e
}
) W! q3 j7 ^8 ?! u1 [else if (document.layers){
- ^2 \; _# r: E2 X+ n% sns_marquee=document.ns_marquee.document.ns_marquee2( I3 r' k7 c" n9 E2 V! k
ns_marquee.left=marqueewidth+8
6 {2 A( i6 |+ R) {& ]ns_marquee.document.write(marqueecontent)$ C' N% n# j' v3 y1 t5 k, h
ns_marquee.document.close()" m0 R0 ^3 n5 f1 r- R3 Z
actualwidth=ns_marquee.document.width
7 ~+ d1 m& ^9 ]3 W2 h}
8 S1 `& E9 v. N+ K7 c7 g: W* c! ~5 t0 F% Glefttime=setInterval("scrollmarquee()",20)5 [, _" A9 o* m- s
}
( Z  [$ b  f+ _' Gwindow.onload=populate5 y2 u1 a, C) M" E
$ ]- K4 t" D( F' K
function scrollmarquee(){
( D2 u! o8 |) U% @( Sif (iedom){
- |! h: O8 B4 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% q% r! b0 V; h7 A4 y% p2 y5 ?# z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" e' a7 m( n% ?
else! R9 M6 k0 a1 S
cross_marquee.style.left=marqueewidth+8
) i( m  @9 c  \* B( D; n! a& h% S7 d
}
( y: V# h0 J+ U2 gelse if (document.layers){
* \7 z4 }1 u+ Q2 S1 Pif (ns_marquee.left>(actualwidth*(-1)+8))2 J5 {  i$ P3 h
ns_marquee.left-=copyspeed' \8 o9 a! u$ h" N% P( H3 d
else
  l# o2 _1 E- j# d) Z% Dns_marquee.left=marqueewidth+8: @! u0 y) k( J$ K7 @
}; O; \( t+ `5 T6 S$ M$ M2 K
}
! v& ^/ ]1 S5 D4 k
4 y/ n5 \0 [8 u% \! tif (iedom||document.layers){
6 z  Q8 [! }! D+ [# G, `4 X1 Kwith (document){
5 d" t' D) S9 c: A2 u8 c) V) |5 Q( u- N. ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 q' }. m5 t) p+ _- jif (iedom){
% \5 }( d3 w, P4 R* N2 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), R# m1 s: y  T& d( C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) c# s) \+ E4 S  d8 J4 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& b; j4 N' V6 ^! `
write('</div>')
) `9 Z) u0 `' m6 f4 [( @}
4 y; P; _8 I) A: R1 Velse if (document.layers){
( e0 U4 v6 Z8 N* d4 `, _9 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 `, X9 I6 p3 y' C/ I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# q- l* p& H0 h
write('</ilayer>')2 n4 N- m  ~: m
}
% V' ]- B# t1 o  z$ I% Vdocument.write('</td></table>')' n: q1 Z4 R/ c* x/ C! H
}5 l) y+ }, f/ h$ ]  M' U$ {
}
$ a+ {8 j! O" @1 H/ O" Q</script>

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