|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
) _. {3 H) i* |$ svar marqueewidth=300
4 [, n! H0 `2 o+ n0 L8 v//高度; C0 b4 l* \% p9 y# z: _
var marqueeheight=25# y9 Q2 O: ?. m: S' H
//速度(1-10)
7 q. a$ k) U4 K. }8 ~var marqueespeed=3
; K- T% w' G5 o- G) q7 ^0 U u//背景颜色
8 y* c$ d- J+ \var marqueebgcolor="#FFFFFF"
5 E+ \# z5 G' y" ^9 j P//是否能暂停 (0=no. 1=yes)?
- J) E1 F, g' d# Wvar pauseit=11 O0 ^7 D, h \7 }! i( l& I9 T
+ L& W9 B7 _2 `- z//修改显示内容! j) y: a1 N6 q2 e m9 m3 t) c5 v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, A$ O. y* @$ I) s, C" b* E$ d: e* \% \& M n
/ G# b/ ?" z2 z" d+ A8 z2 U7 e, Y% b
////下面不需改变////////////! p1 h- C8 [& M! M* A/ M
8 W6 I- f3 w% t% J/ q7 V
var copyspeed=marqueespeed
) T, g; z- g) X5 W8 s5 c, b, Gvar pausespeed=(pauseit==0)? copyspeed: 0* M t6 C U9 g* I/ V
var iedom=document.all||document.getElementById
4 Y9 t" s2 o2 s7 G1 @4 Y' Aif (iedom)3 m0 U' c" i6 K3 X. l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) q$ n k; G1 Y# a3 N! g4 l- z4 vvar actualwidth=''1 n# i9 O! D' r" g8 k
var cross_marquee, ns_marquee5 t# o/ `, u) I/ }( | {$ V, |
p% s; q5 M' R& i1 C$ Vfunction populate(){8 j; T7 O5 @$ t
if (iedom){
& U, k$ \7 T) X0 z& Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 i. B1 r7 `% r! a* A- o' }
cross_marquee.style.left=marqueewidth+8
1 C- M/ t$ @. B* ?3 p9 J6 Hcross_marquee.innerHTML=marqueecontent
3 P& Z* [, W3 d$ e: @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 N& o1 Q/ v% ?: Q6 y}
4 \& f2 e' E- |8 N0 s+ O6 Aelse if (document.layers){9 y1 @0 B* o9 P- y8 Q4 X
ns_marquee=document.ns_marquee.document.ns_marquee2+ I, [" a6 N! |
ns_marquee.left=marqueewidth+8
# D! C: F$ U& M. W7 W$ g# h! w. zns_marquee.document.write(marqueecontent)7 A5 t) H8 K, J, l& X' D
ns_marquee.document.close()
; m/ F4 g9 v7 _* }# qactualwidth=ns_marquee.document.width" R* X5 `. q( _
}: k: L8 v) `! v( p% [& G% `$ |& Y
lefttime=setInterval("scrollmarquee()",20)7 H9 {: _0 G+ d$ G
}
+ U' k. w! p0 Cwindow.onload=populate4 k9 c1 v/ C! ~ R8 Z P
8 L1 I6 e/ a/ t/ }" @! |) y
function scrollmarquee(){! u! n$ J5 \5 y% W
if (iedom){. @7 Y1 ?5 H# }& G, F* I, D1 k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 |* x8 ^! ^; Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) ] ^" N: P# W
else9 G' A) M* i. f$ I
cross_marquee.style.left=marqueewidth+8( o! r& L1 C% b$ B' L+ Y
+ e) W2 ^6 C% R' U* [% w
}8 l# `$ b- W: K0 y* P0 w8 n6 b" C" e
else if (document.layers){
; e: l1 A) e# Fif (ns_marquee.left>(actualwidth*(-1)+8))8 j. O9 k& {: c
ns_marquee.left-=copyspeed
! z& E! X1 G; t9 Y, U8 Nelse$ N) A+ [* s: W
ns_marquee.left=marqueewidth+8
4 s" h4 c1 k) h}
" R0 Z( W" x8 I1 I: k$ d}
% z4 y2 `' U% t; J/ L4 \7 y4 h. K+ I$ D7 l, F
if (iedom||document.layers){4 ?2 z( |8 {. L3 E
with (document){( z) V3 N7 A: f) R' Q4 t2 w' w' p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) w3 ~* w& N5 w/ K+ Oif (iedom){2 @5 {% I; D4 F ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' a2 R- W8 D, a0 `$ ]% H, [- J' y9 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 v2 v( J! J, B$ uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 ~8 C; ?( S# ]' M6 E
write('</div>')) l" V9 f4 w+ c# ^+ x
}
" F% x) k. N E5 \( L7 xelse if (document.layers){: {6 R' w7 B4 p( R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# c6 e) k2 {- r- M+ X0 m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). x: Z5 o s' l% N
write('</ilayer>')! A4 `9 r; R6 z. G% j- C4 z/ K+ B6 M
}+ V/ f6 g }; i: z* v3 D6 b6 P) J
document.write('</td></table>')) J4 t! q( h: {
}7 J5 t; Y/ ~7 q
}" T9 |! X. \1 d7 V
</script> |
|