返回列表 发帖

网页之跑马灯文字特效

//修改宽度; {! o! t1 w; I4 }: O
var marqueewidth=300
+ {9 h1 b1 R2 [( v) Y//高度8 U; }! A1 u1 w- ~5 m. A
var marqueeheight=25! u7 Q2 e1 W+ p$ G# N6 A" M8 V
//速度(1-10)
  }! ~6 y. ]) J4 r4 Hvar marqueespeed=3
) u) n: n7 D6 Z# t//背景颜色8 o+ \' ~) J, w' W' ?2 |0 v4 ~- b
var marqueebgcolor="#FFFFFF"
+ o- j3 }1 V0 \* b//是否能暂停 (0=no. 1=yes)?1 }$ S0 `/ f( i9 e% B# ]
var pauseit=1  |; m# n3 t( q- o0 W- `
: J% w: y' E+ T& }9 v. g5 R
//修改显示内容5 r* O% a1 S5 {, Z& ~9 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% _6 \/ r7 d4 S( _
9 @3 C, j* z( j# y  K. L1 ~

# [4 `' X7 l4 j////下面不需改变////////////
* h7 N/ F. W# }8 x, P- `: Y
, \+ ~" _: p. v! j- Wvar copyspeed=marqueespeed
' }! X4 {+ f6 P0 M+ L8 P& T/ n. `" dvar pausespeed=(pauseit==0)? copyspeed: 0. h* N( P$ g2 r
var iedom=document.all||document.getElementById3 |& T1 I2 q' E: l4 Q% w  p+ j3 ~
if (iedom)
/ T4 u4 ~4 ^0 z! kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). i& V. E4 {5 \0 M- W- g
var actualwidth=''
9 Z& i& A  C1 c9 c9 mvar cross_marquee, ns_marquee8 g( @. m5 O# s. n

( t/ H5 V! H( C5 M/ X; Jfunction populate(){
( h1 Q  Y* @0 i8 G1 Tif (iedom){
6 J- \8 N) |* E0 x# J/ Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' e7 Q4 N  B* K
cross_marquee.style.left=marqueewidth+8. X) s5 w% L, d& v* n- N: u
cross_marquee.innerHTML=marqueecontent
7 ?  V: K* S4 g* kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 q* |; \9 v! o3 L# Z2 S}) ~. i! G) B( G$ Z% ]  i  O6 F
else if (document.layers){8 u* S: d5 M3 S! O. Q* f
ns_marquee=document.ns_marquee.document.ns_marquee2
, h; V; G! ~5 ^7 }ns_marquee.left=marqueewidth+8
0 J; g' S  E' o- _3 K. \% Mns_marquee.document.write(marqueecontent)
- m+ W# c5 M8 A$ @ns_marquee.document.close()
2 h# l  H+ b6 T4 C% }3 T; Hactualwidth=ns_marquee.document.width
0 N3 @5 X8 w: O: ]6 d- g+ v' [4 V: W! B}) E$ S- r2 R$ p6 |5 y
lefttime=setInterval("scrollmarquee()",20)( k) E# I$ U4 r5 H! t1 C; s
}0 l; n, ]3 x$ m2 {
window.onload=populate. M% a: F) r7 \; q! Y
; F# h, o. U$ Y, R9 O* t
function scrollmarquee(){% n, g) U! z: p% n  h6 G
if (iedom){: z) t5 k( ~8 L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  e- G( C% D: `; @6 Z. A) k: ~+ N3 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 X, V& ^+ e, [% Z+ o4 w9 G" o" Delse# N: t% @4 D8 N9 V* I
cross_marquee.style.left=marqueewidth+8
+ d) |2 ~, }$ K. }. A
9 g( n$ ^+ E0 |; ]; \}
8 O8 z) h0 P# T5 L( K+ g* {- Kelse if (document.layers){7 ?) [* S. M3 A0 \; w' Q
if (ns_marquee.left>(actualwidth*(-1)+8))7 e  Q2 n' E3 Y2 z: @$ D1 X& D) v
ns_marquee.left-=copyspeed
5 I: R8 \# j) ]1 c0 m  nelse" ~) _; R9 ?8 h3 V- I! R
ns_marquee.left=marqueewidth+83 C# c' o5 i- F, X
}
. y2 @. ^# f5 t3 {$ i" l}9 D! u0 x) j/ u  D
, `1 k& q) _: o' I6 T
if (iedom||document.layers){. U1 w0 n& B7 }* o4 V, F) P1 r
with (document){4 t% H% a( S  q4 j% s# x) }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 }" J4 C$ _/ n( G+ ]0 I
if (iedom){
6 \# C7 C) y( E: r1 [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# ^+ X8 J( `* Q- }/ iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 M9 ]3 Q7 |7 i4 \& E: Y; ^& w& ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. Q! a. H% B, m: R9 N) N) z4 Kwrite('</div>'); P0 y/ m  u% ]# N7 g( U
}
1 [6 P/ a  p0 @1 M& Yelse if (document.layers){! I' ^( g3 l) T9 X/ R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ }6 B8 C! v  ^6 z0 W  f- r7 Z7 J# {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 Y" w2 [+ Z2 l  A0 _write('</ilayer>')! J( s. ?  f: u0 T7 M
}
9 i5 G) e" a) [- J9 a7 ^1 m! F0 mdocument.write('</td></table>')' Y, s- X7 c: D2 x# U2 S
}
; I/ J  R# J9 ^  e7 I}
7 e* K; q) g& h0 W% u</script>

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