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

|
网页之跑马灯文字特效
//修改宽度
: p% { y* `$ P$ x* y7 T0 L Vvar marqueewidth=300
" W, v, Q7 @- Z* m//高度( r# t+ ]+ k4 |/ V; _
var marqueeheight=25' \# c0 V8 v+ u* F
//速度(1-10)
, h1 m9 f/ g# z2 qvar marqueespeed=33 s: K) u+ N3 u& V) U2 E3 \; _
//背景颜色
^1 x% v, y/ r; [' jvar marqueebgcolor="#FFFFFF"
! R: u8 X9 _7 d; @ E9 |//是否能暂停 (0=no. 1=yes)?6 l! I4 P3 V; z; V/ A
var pauseit=1
. K6 F- K+ D8 B) i8 C' y; s, x L- C6 h
//修改显示内容. R. x: c, u( |1 S( u) Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ Q( \8 i" j9 y2 G
; X: r1 c5 D1 e
" M+ J. ?) g' S9 }, y+ q4 E
////下面不需改变////////////, S {/ q0 s) K
" I! S- X* G/ P
var copyspeed=marqueespeed; @( K6 ^( N. G
var pausespeed=(pauseit==0)? copyspeed: 01 J, Z( f: T4 S, ^$ y
var iedom=document.all||document.getElementById
* T$ f( [9 } o5 V8 z- ?if (iedom)) {9 z& j* [1 K. X% Y! F% ?: |& J2 i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Q2 {& e0 d8 j6 t. e) ?var actualwidth=''
i$ P$ E; h' `+ [0 O3 ?2 c) Jvar cross_marquee, ns_marquee2 k3 `8 R8 N7 ~/ G. z) I& l
: v: p1 C9 M" l4 Q0 I. rfunction populate(){! W* E& m. [+ f5 f4 N" f: q
if (iedom){. k( h% C4 F; h+ V' H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 S9 i+ R1 Y, icross_marquee.style.left=marqueewidth+83 ]" K, i' v8 c& Z3 y$ ?
cross_marquee.innerHTML=marqueecontent d. A- y: c, F3 i+ z* Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 S( ~5 h; k! S! v4 c
}
' n9 t# T/ @" z" H# \0 V& gelse if (document.layers){
v3 b4 t: s; ~. ~ns_marquee=document.ns_marquee.document.ns_marquee2
1 ^( M" @: {2 D: k* N: Ons_marquee.left=marqueewidth+8: k0 `" h2 C; h) V
ns_marquee.document.write(marqueecontent)
- U. x8 q' `$ l6 T: a7 {+ s1 Tns_marquee.document.close(): D8 L T; M$ ~) }
actualwidth=ns_marquee.document.width' X2 B. q* L; l# j# j& X
}
X# n- y8 p1 o6 r8 e" ]lefttime=setInterval("scrollmarquee()",20)
' U/ K" h/ N3 Z8 x}
; N4 B7 i* r S7 M0 q8 bwindow.onload=populate
" |& I1 Z) {7 S7 B( J# y- |/ D+ |2 g: z+ ^! f8 Z0 [$ n& u" v
function scrollmarquee(){
/ F7 D0 F; w+ ^8 P" a$ Gif (iedom){- _, k: Y" V1 E$ \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, j6 A6 s* ?8 ^# N# @' i. Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' u+ p a( R' Y6 T& n2 w& v- Eelse3 m5 T$ B8 W0 Q, ]' C; z
cross_marquee.style.left=marqueewidth+80 V$ Y7 L5 k# u, a; S* m6 V% k
) z$ G9 a; I0 n+ {}
4 `7 o( M4 I6 `3 P, h# S" Delse if (document.layers){
! h! g9 \' A5 p0 S+ G. Xif (ns_marquee.left>(actualwidth*(-1)+8))
* P: c0 C% e! Gns_marquee.left-=copyspeed2 y5 T( i s; X% G: Q' @2 h( J
else
2 C3 U! ?, R' o) E3 v7 T) ~5 I5 l( qns_marquee.left=marqueewidth+8
3 k2 t; a3 i' w" ?% r e}0 D! X! O6 D) E( r* p* r
}
* R9 i+ ]9 Y2 {# v h! S6 Y
+ R$ R) b9 z0 T' ^! f' O% o! Uif (iedom||document.layers){ B2 y2 R4 q! O6 P
with (document){7 N! k& n5 K0 E, S5 m: L( ^+ l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# H4 u3 E+ H8 D- |* vif (iedom){: ?. C. M4 ~. a+ W8 C3 ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, s+ P( r0 m- Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ d$ {6 g/ m M- _! C, `% R/ t/ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) d. f6 q( `4 xwrite('</div>')
" c7 k* j$ L: a" N6 T}
9 R8 x% f* k8 }5 X: `' belse if (document.layers){+ k/ P1 t1 x8 k5 g+ |: Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 f' m1 Q% C* x* u. ^7 Y2 t; V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 `3 P o3 {; D& M0 ?" qwrite('</ilayer>')5 \; J- \5 a! B1 e" q7 ~; o2 L
}# P* U6 }9 G. b
document.write('</td></table>')
" }/ x4 Y* E8 j}
, ?# W" g8 e9 J* q: Z8 q, V" t8 q; H}
h- I {2 M' }6 n</script> |
|