返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. c- N. l3 o) g( a) T/ p4 X0 P0 {" Tvar marqueewidth=3004 Z3 Q: d. S& m3 p; x
//高度! O: u# U/ V* y! c- B
var marqueeheight=25. t# X: r$ {( s
//速度(1-10). a# A! D% ^/ _4 M/ x
var marqueespeed=3( k( A* o/ z: i2 v: D3 {- H
//背景颜色
8 W" e5 S: P4 b6 E- \var marqueebgcolor="#FFFFFF"2 O- D6 h  G) C/ P8 o9 v7 V4 i
//是否能暂停 (0=no. 1=yes)?6 `: N5 c1 a$ e, }6 c' N2 U; p
var pauseit=1
: @5 G  D6 v. `5 U4 x+ d1 T- j+ e) o6 z+ h" o
//修改显示内容1 v: c- c8 O" ?" e) |9 s; b7 m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" M" G  t- b# ?5 J, E# j
0 p! U$ @- U; O9 `8 z' h9 o2 b
* o' H' |6 T) s
////下面不需改变////////////
0 u4 `0 w4 N2 ^- J' c' X+ Z/ [2 y6 I0 S6 C" E4 w/ o$ p
var copyspeed=marqueespeed
8 }) X7 V! t0 ?0 n  ^var pausespeed=(pauseit==0)? copyspeed: 0
1 j# y# X- o8 Y  x; Mvar iedom=document.all||document.getElementById
( ]  m. N( Q+ a; d7 Uif (iedom)  Z4 q; l8 @% P' B6 u. j8 \( }5 `3 V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( x: a1 V& o$ j, V  t- m0 p
var actualwidth=''( N! n1 a4 Z  A' W
var cross_marquee, ns_marquee3 r5 k0 E$ H5 e3 }
$ J5 K* S6 D3 {4 Z! m- g6 L
function populate(){
* J% _0 V) x5 |3 j! Q7 c( Jif (iedom){$ N1 D( i2 _7 R. i9 U6 b5 x7 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* b; n* D" B* H) r* t( a5 E
cross_marquee.style.left=marqueewidth+8
+ d  u) m' m0 Y' l5 vcross_marquee.innerHTML=marqueecontent$ B3 G: Y: `. F: T3 u0 N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% q, t# `9 K: o+ R( Z0 g: a+ M; i}. {7 _# c' }, {/ @: @' s: N9 D
else if (document.layers){
6 [* h& ^- Z6 t# `6 Lns_marquee=document.ns_marquee.document.ns_marquee2
' o; f$ T" K% Z: O( `ns_marquee.left=marqueewidth+8. z8 @1 _' S+ C# @3 a- Z5 J
ns_marquee.document.write(marqueecontent)- U2 M7 z+ \1 }* s- N' V  ]2 L
ns_marquee.document.close()/ E- t' {0 X( F8 N8 ^( x4 ^
actualwidth=ns_marquee.document.width
$ n) F3 F7 y! F+ i0 v}
2 ]- B" B  M& p9 o# mlefttime=setInterval("scrollmarquee()",20)
7 V  m- m) c. |* h' e}3 k1 }# O. v4 X2 D; Z3 d
window.onload=populate
0 q7 T1 f2 X% R
6 i. }" C) Z8 Mfunction scrollmarquee(){
: d: g6 I( d, {: Pif (iedom){
9 \' ^/ b# n7 Y8 {( r4 I. \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# n% u; k; s, s2 M- Z2 K9 l4 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! z3 [) U; `( Kelse; e0 C) f: [' L. i; d4 @( e
cross_marquee.style.left=marqueewidth+8
+ a& ]0 C# a: ?; X( o- C9 R* P2 h! y2 x! g' K
}
6 n. r1 ^9 H& Q$ T/ {/ Z' W. \' kelse if (document.layers){
' }$ O4 @  o4 ]: G: S0 ]/ wif (ns_marquee.left>(actualwidth*(-1)+8))
+ e3 Y4 A% ^& X+ q! F; A; Ens_marquee.left-=copyspeed  |$ v8 u7 A* a3 D- n
else
8 v7 y3 @9 ?2 }+ g/ y" C$ ^$ D: Nns_marquee.left=marqueewidth+8
6 Y% @0 f4 h/ s+ D; ~}" F% j3 L  R4 `5 [+ {3 G' G5 G! |
}
$ q2 n; `" c8 r8 B! ]+ j
0 c' F* f( p0 b: q9 a# bif (iedom||document.layers){; e! ?! v8 A; M- t3 k+ d$ J7 t+ _
with (document){' c; z9 ?( R( P& l$ W$ r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- O8 l# O( p- T0 K. x7 Z8 D' ~1 yif (iedom){
( k/ `$ o# D" y* e1 ]3 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ ~0 d: |4 a0 L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 I& G1 F$ ~8 K1 B- R7 V3 A- rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 V# m; A: B! S2 o% q7 D! i
write('</div>')8 E$ K8 p6 T+ A0 O/ }; e. [& ]
}, C$ ?/ j) {# ~9 V( a
else if (document.layers){; L: @# b1 o) w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" o2 a0 r1 B7 N2 g% j. I2 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 }8 G% S1 k* z. jwrite('</ilayer>')
" V. A& }" \$ }! |5 T  |* e' P}
# o9 c% L8 N& o: Q$ D# U$ udocument.write('</td></table>'), p% v# ^2 q! O0 R, D& m
}$ _5 ^( r: C+ `. c8 v" J7 n
}
0 H: s0 |' k+ r. ^# K; x; w</script>

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