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

|
网页之跑马灯文字特效
//修改宽度$ z3 F7 ~- s' E x3 n7 [8 J" c
var marqueewidth=300; \: Q; H' G b! G7 O7 r
//高度
8 x7 i. ^6 z9 e0 h! Uvar marqueeheight=259 Y7 G3 [2 w e7 [' X; k
//速度(1-10)7 o7 J1 m, V) a- ?6 T. \
var marqueespeed=3. T+ y' V9 u0 c0 u4 {* H) }
//背景颜色, N- @$ |* D2 }2 G. ~9 R! S
var marqueebgcolor="#FFFFFF"9 n K; ^" a6 X0 i' Z! x; e; T1 H
//是否能暂停 (0=no. 1=yes)?7 c8 g& N8 |6 b/ c+ [7 w
var pauseit=1) a8 s3 e) `" N6 V) N
7 y* W0 W' O; Y, X- U+ l/ e//修改显示内容/ _# m$ R! ?; Y( ?& d* D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 y/ B& M8 D y3 G6 W& p
& d5 M! g7 `3 b, C* ]; {/ |
' M& \ Y* p8 F# b% y
////下面不需改变////////////
l) k3 t1 S6 ^: D0 h3 |$ y5 `1 `9 k' E' F/ F8 K, b
var copyspeed=marqueespeed
6 q6 ]) {1 {0 Mvar pausespeed=(pauseit==0)? copyspeed: 0
) m% a5 a0 e$ B6 b- j( b+ Xvar iedom=document.all||document.getElementById% A* k/ U/ c! E4 n
if (iedom), Y- j2 s, b. h0 g' z9 H$ y$ H$ p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 t+ N1 S+ W9 |* y, E2 Z5 s
var actualwidth=''& X O+ M+ r( @, H, a
var cross_marquee, ns_marquee
. d/ K9 n$ ?+ a
& T* M3 n8 a- C. x0 Bfunction populate(){
/ b h6 ~: q) Gif (iedom){
7 C$ I9 Z1 e% B6 d d" ?) |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ K' m8 ^0 U; o$ D' xcross_marquee.style.left=marqueewidth+8
( B0 K: B. Y3 d* G1 Qcross_marquee.innerHTML=marqueecontent
) L/ k* E! ^- I2 \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 e6 P' F; A. C8 ^+ l}5 {* K: {! G& K" m, B' o1 j7 ~5 E
else if (document.layers){. V. C1 {8 r% t# v& ]# A2 D, [ Y. p
ns_marquee=document.ns_marquee.document.ns_marquee2% h$ z4 T9 ^( [6 N
ns_marquee.left=marqueewidth+87 y" B! }, J) x- r+ A9 o4 |
ns_marquee.document.write(marqueecontent)
1 G3 U* \0 J. l1 U' e' J6 _+ \5 X0 Qns_marquee.document.close()
. P# p: I6 f! y8 Aactualwidth=ns_marquee.document.width g E( T2 i6 x; C5 K
}, y8 b; s b h' {0 u; C; a4 T! K0 h
lefttime=setInterval("scrollmarquee()",20)
I/ G y P; D$ d5 i' X}5 m5 \3 {3 W5 l$ F; }
window.onload=populate
( ^* ?1 }& n( E
7 V. V# V& q: W: Q/ Q: vfunction scrollmarquee(){0 k$ v. X: ^1 M
if (iedom){
; q$ v8 T k, `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 y+ Q( T% t7 v4 |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ l; ^7 J: M/ p- {7 selse% L( g/ P; I7 J
cross_marquee.style.left=marqueewidth+8
% a! h: [9 H, I4 U7 ~+ e8 @3 m: {0 ^- @/ |$ r3 D$ {
}
; q/ P3 ^! W1 p3 oelse if (document.layers){
; d& o: @4 q$ f( t9 Kif (ns_marquee.left>(actualwidth*(-1)+8))
1 A$ D6 c- \. xns_marquee.left-=copyspeed
0 C8 r* y7 ^/ H% D; O3 melse
6 J: Y+ ^$ y' p/ f6 wns_marquee.left=marqueewidth+8% T9 z7 t5 g2 ]: L% a q3 u
}% K( }! Q2 ]( n( O* X* Q* D
}1 ^6 p7 K( F1 o' X3 t) o
5 H% g- Y4 p7 X
if (iedom||document.layers){
) O% y2 @3 q- p1 f2 qwith (document){& ^* m9 Y& w( b0 r! S9 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& d, p9 [/ d! o% Z" Jif (iedom){
- r8 n( F7 z3 o5 P' [2 rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% G Q( {1 S$ H8 p* G$ c. Q2 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& \9 {5 _5 |; k( h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( M2 W+ A* k8 r; ?! Z2 f
write('</div>')
- Y) F% U# m c5 g, l}( O& g$ M3 @8 z" X; v' y! s: U( u9 ]" Y
else if (document.layers){2 {( R* k$ ]6 `, B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% o6 {8 g8 a" A$ _, o; mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& v) U3 }2 l) Y
write('</ilayer>')( b3 l, {8 M" ^
}
. ]6 w+ O9 Y: ?. h5 X* Q$ pdocument.write('</td></table>')( d7 Z0 K- S+ \# _4 y! [* H/ q! O
}
) J1 @9 \( L- I}; Z: K: S3 J% G; R7 _$ g# w
</script> |
|