返回列表 发帖

网页之跑马灯文字特效

//修改宽度! C: a0 M. `" f4 Y4 ^1 ~3 Z% V  u
var marqueewidth=300
' |! ~4 @2 v0 @0 G7 _; [//高度+ L1 g: o3 X; \, I6 l1 D6 F- f  z; `
var marqueeheight=252 V2 Y. w+ S7 p2 H& i
//速度(1-10)
5 |0 i# Y7 k* S- f, l2 ]$ b/ k: U  f% ivar marqueespeed=33 q) p7 f/ B" I  d
//背景颜色& v, p2 j& b3 I! X  R* m" X5 c. e
var marqueebgcolor="#FFFFFF"
9 B; p2 E% V  k+ s//是否能暂停 (0=no. 1=yes)?& z* Y5 Q5 d( k9 D
var pauseit=1( f2 G0 U5 D! r
9 W  @5 ^4 `6 p9 D9 \4 P
//修改显示内容
# ]6 ]+ x* s3 r& m" t1 s& s8 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 {2 d7 |; M+ f0 P  P

$ s6 V; T/ L. V, q5 h
: B. |2 M: h( q/ s; J& b////下面不需改变////////////# o' W# h9 S% z& p" q
& a) ^1 D/ l8 x
var copyspeed=marqueespeed8 ~( b& }( y" S
var pausespeed=(pauseit==0)? copyspeed: 0
1 |# j% C3 i  v9 d  B3 B, Ivar iedom=document.all||document.getElementById3 `6 z" K! I$ F1 k; y& G
if (iedom)
4 }: Q9 P  D$ V- A7 k6 N( _$ D4 Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# h! i8 ?8 R. R5 y: Y# t: tvar actualwidth=''0 x4 r" t6 m$ p. J
var cross_marquee, ns_marquee" h5 v$ d8 K" D1 N
  d% T; B8 B6 X1 B
function populate(){
/ i5 f! b( X5 V6 v7 G4 dif (iedom){- H/ l& e' }. l2 g; @3 c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' M$ n! b, C+ `7 q9 b8 Icross_marquee.style.left=marqueewidth+8" C+ c$ b5 t& G  O
cross_marquee.innerHTML=marqueecontent
/ H: s+ N& P8 x% ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 n0 e' r* e5 h% b$ y; B}" ?% z, X$ Z4 p, t7 m
else if (document.layers){# H1 z0 X$ `9 H& T" w
ns_marquee=document.ns_marquee.document.ns_marquee2
. R$ E2 m1 m1 U0 v4 L+ {) mns_marquee.left=marqueewidth+8" P4 b3 ], I7 x" M) Z" Y
ns_marquee.document.write(marqueecontent)
) t& m' N, T, r. mns_marquee.document.close()
/ f, Q, y6 R! Y6 Hactualwidth=ns_marquee.document.width% a  d8 T5 A7 w4 a0 i  O* ~+ r3 b
}
* R$ j) Y2 `; }$ ?) C# k: k2 r- Tlefttime=setInterval("scrollmarquee()",20)
4 g  R8 e; ]& E# b5 q; b, Q0 N}
5 g8 F% L7 k$ r* g* zwindow.onload=populate& e* O- O& Z/ r" k& l5 c1 t

3 C5 C5 y. Q' q, [function scrollmarquee(){
$ A! g8 ?. @" o: Bif (iedom){
; [+ T+ P2 S2 s' T$ Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% @' p7 V/ N2 J- F2 k0 v7 a1 @) ?- ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 \% Y+ G1 O. K% t! W4 j
else) h, W4 [9 H( O$ G& |- r( q1 G
cross_marquee.style.left=marqueewidth+8- w, Y% u- b7 s: Z6 W" J

2 Q6 k2 F5 c! }* q4 s6 R1 `}+ r0 q9 U: T9 [: z/ G: R) @
else if (document.layers){+ Q" X& ]3 O$ c/ j
if (ns_marquee.left>(actualwidth*(-1)+8))& s* x* [9 Z: S; B* o7 X1 b; n
ns_marquee.left-=copyspeed& q7 Z% {9 X9 w, Z: |& {
else
2 {6 Z: E/ Q( t2 W- g1 Gns_marquee.left=marqueewidth+8; M) J# X! C6 a7 `" P9 ~% A( }
}) r) v( X% S: Y- X
}/ {# F8 U) }2 H

/ ^: y# f% c) ^% Q2 @- e/ Mif (iedom||document.layers){
( Q4 G1 S( B1 G* Y. U+ Awith (document){
; J9 a8 o6 `' L1 e: L6 j/ Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) E2 z) w' t8 ]; Cif (iedom){  A' m6 H/ J/ H7 `  c" o* J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 P" A+ K7 o' Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  O7 Z, X6 E8 E2 E4 Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 X/ n; n, K( P  ^/ c( F1 k
write('</div>')
- ^( ^/ m. M! f1 T- U# K) s1 w}4 [; I2 G: R  [0 a; I
else if (document.layers){  _* y2 }  P7 e. y+ `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 W+ Z2 \5 h( }: E6 P1 e3 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& S' f2 ]4 a- r# X
write('</ilayer>')+ [# B- j% e; t8 {0 U" H
}8 _" B( _6 Y* y4 I
document.write('</td></table>')
! c, A7 K" [4 C3 F}
6 M4 E9 [. \" u7 F) t* t8 T}9 y/ d* K- U% F" k
</script>

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