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

|
网页之跑马灯文字特效
//修改宽度
9 X& v; G, j" _; K& |var marqueewidth=3007 s4 u* p: y) ^: X& @* g0 \
//高度
8 E: i* W. u3 nvar marqueeheight=25" i6 V: V% y7 s1 ~- c# W; o1 _+ g# W8 i+ {
//速度(1-10)
9 T" a! P/ z) wvar marqueespeed=3$ t4 S( A, j+ }5 J3 e% V
//背景颜色; D* D+ m M" c5 @0 D; w+ Y
var marqueebgcolor="#FFFFFF"8 |9 v8 ^8 n8 K# M
//是否能暂停 (0=no. 1=yes)?
9 S% b, Q4 h; _3 fvar pauseit=1
7 X$ N: }! L8 x0 m! Z: r3 R2 Y$ x L2 p4 `; O7 O0 T* G
//修改显示内容
! n' W4 U; I" Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 K: a; m8 m+ V* g j: U5 U) B/ P9 |4 K; G2 x
8 Y5 M' a T2 |- U, G
////下面不需改变////////////
. ~9 A4 u6 K- |& W, M7 V* X
3 \+ u8 O- `( W. Fvar copyspeed=marqueespeed f$ N7 u; B/ b+ |2 J! s
var pausespeed=(pauseit==0)? copyspeed: 0
& N# k+ c6 R q" i. Ovar iedom=document.all||document.getElementById
2 a" G3 A. i3 fif (iedom)- B) H1 j. [: [+ H" c9 \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 M6 p1 W4 x7 P! @: T! O) c
var actualwidth=''
# k! Y2 I2 c1 O/ Svar cross_marquee, ns_marquee& E6 @, }' R$ f9 P" ?" a- K
! f# j' P- W% H. W/ u+ q G/ U/ p
function populate(){
. A _9 _+ d4 Z# o' W Z$ v% Kif (iedom){! S' ~! H4 f' v! n+ p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( c& m% A1 \# E& @6 u% u: v+ M
cross_marquee.style.left=marqueewidth+8
" |7 c: v' B$ N+ ocross_marquee.innerHTML=marqueecontent
, C# h$ Y4 v% w3 D- h y4 ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
P2 s2 e: n% U}/ [" W0 d* b% e8 v2 T6 t* ]* F' \
else if (document.layers){; Z. @; }9 m6 ^8 Y8 |
ns_marquee=document.ns_marquee.document.ns_marquee2" `3 j7 R* V9 ]- Y' D& u' x1 N
ns_marquee.left=marqueewidth+8 }9 b1 s$ t' t, t
ns_marquee.document.write(marqueecontent)
4 ^4 C3 d+ C8 @6 j9 Xns_marquee.document.close()# U; O. Z/ h! ~' M# E" v# J
actualwidth=ns_marquee.document.width, @7 ?% _. b$ D5 O, l: L; M
}6 t# ]% l% {0 q/ t( `
lefttime=setInterval("scrollmarquee()",20) Y6 }) o% k: B" r, k$ ~
}7 L8 A5 f# ]* |4 \' e" Z
window.onload=populate& r/ H& v0 y3 e9 N
8 f& C( J. t3 K8 O( t+ i- ?- r) Q9 c
function scrollmarquee(){( }+ U" G* H$ m+ J
if (iedom){# C! o- v4 n* s: A3 E' P$ _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): J, E4 r+ t: c, O( b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ X) ]7 Z2 M# X
else; ~5 T; u; Z' M; S9 b2 F
cross_marquee.style.left=marqueewidth+8/ M) V! r, R8 k o
" J P [6 Y: m( R& @
}
# O6 L; s: z2 O; K, C m( telse if (document.layers){
' ]- a7 M7 N: L! Cif (ns_marquee.left>(actualwidth*(-1)+8))
6 Y; c4 _- e! g* M# Ins_marquee.left-=copyspeed
- l( |4 Z- K7 d9 S% [% Telse: C$ v9 |" {; H) o/ y6 d/ t6 o
ns_marquee.left=marqueewidth+8/ p* e/ |0 V' f! U7 L
}
4 F2 r4 i+ w; t) I7 @} }# m( t: J8 w/ ^
+ a- c3 k. i0 W, d
if (iedom||document.layers){ H8 _6 W' x: p5 I' O
with (document){
2 Y0 I- c4 ^! Q; z/ ^5 Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 B8 v" K3 r# E% m4 A8 u9 ?if (iedom){! C) g, ? g2 x( T& ]# ]: i4 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ j$ T) w7 {3 A/ j, u2 Z0 c$ Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 ?4 h+ L o- l" l' D) `8 z0 y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% h/ h) Y Y8 K" N6 Y2 ^5 rwrite('</div>')% A* I' e0 Z& {6 K6 L
}
# e- V2 Q0 b: m9 f3 W0 welse if (document.layers){: |5 k' r T5 r3 Z* e# m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 B8 e* [$ p" O( J4 ?; A$ t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" _7 `0 m, L2 P: v0 k; t/ l) i* [, xwrite('</ilayer>')4 i& r- D, @# K5 f7 W4 Z/ V
}) T& O2 _/ u- _. v0 D ^5 I
document.write('</td></table>')
3 G4 J) O: {2 W: r5 ]; W) r8 h4 A}
b& E6 T5 c$ i; }, [}7 o. ^% ]! _2 B7 |/ a8 E
</script> |
|