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

|
网页之跑马灯文字特效
//修改宽度
% ~6 ?. j# D7 G9 V& G% x, z2 w- Svar marqueewidth=300
+ p! E2 I8 H# F6 I2 n! J- `//高度; @3 c- }( G s
var marqueeheight=25: b ~4 h& a& e$ I7 P& |/ Q
//速度(1-10)9 M, S% Y& _% C4 C
var marqueespeed=3
* l8 q/ W- Z4 l8 x+ D' v6 l, l//背景颜色
) y) h1 x( L Y* U8 Y' fvar marqueebgcolor="#FFFFFF"* V7 E4 L1 d2 {2 e A1 B9 v5 _
//是否能暂停 (0=no. 1=yes)?; x' X+ ?' j$ [* z( p& |! t
var pauseit=1" a& `: t& A3 H5 v- }+ x k
. q) W) Y$ i: G2 a7 g! P* W
//修改显示内容
6 ?1 b7 ]$ x& Y# vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' G) G; Z2 h7 e$ P+ t# D+ Y3 E
9 ], R: Q, j- i6 c; i4 f$ P3 y5 ?" E5 N
////下面不需改变////////////
$ o) R4 p3 p2 E1 f7 n7 {
" ?6 y" p4 h4 e" a# a* xvar copyspeed=marqueespeed% }3 t, m6 ]8 V
var pausespeed=(pauseit==0)? copyspeed: 0
# ~4 g2 H5 c: T* X0 j* rvar iedom=document.all||document.getElementById. u G/ {9 _7 z, m2 G" z, I
if (iedom)9 f8 W8 V% l; S% z; D: o" G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 d$ g, h+ L" a1 R5 `& R1 Vvar actualwidth=''1 u$ X. v3 k& K0 V
var cross_marquee, ns_marquee
9 t* T) D6 \# l* Z6 x9 @7 G ^) {% w, d, T/ K* X$ v. d/ ]
function populate(){0 _' L8 y- a& C
if (iedom){
- r% r7 @2 g" E" _' x4 B) Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 I* \( H: m, H. d; y
cross_marquee.style.left=marqueewidth+8
2 {1 \; V% C' z( S( Vcross_marquee.innerHTML=marqueecontent+ i' c$ D6 Y/ O( R( O; K& n3 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. |* Z5 ?: E9 A' Z/ z
}8 k5 w) v: T9 P0 N
else if (document.layers){
' s" I! A2 ^! N) U0 s7 H4 Fns_marquee=document.ns_marquee.document.ns_marquee2
5 `1 a# U/ _' M* N9 ?ns_marquee.left=marqueewidth+8
3 ~2 F4 X2 A8 n% K8 ^! Lns_marquee.document.write(marqueecontent)- `1 @% V; l( ], G8 g0 x6 _! n
ns_marquee.document.close()
* v9 \$ j# `7 F6 N; ~) bactualwidth=ns_marquee.document.width$ I0 B# P2 W! j/ W2 \; `9 z
}
# \3 [$ u# S6 C3 P8 y0 \lefttime=setInterval("scrollmarquee()",20)/ ]* |# r' |' P A
}& B3 e# M& v" V3 J; ^* z
window.onload=populate# X! ~; p4 Q$ E9 C$ Y |, t
) k# d; g. n$ Mfunction scrollmarquee(){9 d' ?# X2 ^3 ~, S
if (iedom){
* i! h: v# }8 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ y1 B8 | p$ w$ Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 I1 L; ]8 h* U! e4 @else
8 }! w. F+ \4 a) V: }cross_marquee.style.left=marqueewidth+83 `; x) N' s+ K; t+ p( A
8 @4 u) W6 G B! o}
3 ^( Y9 a9 _ d, d* I; eelse if (document.layers){) _3 R8 y* m! U
if (ns_marquee.left>(actualwidth*(-1)+8))% ?, P/ S; U6 l* x e$ n2 A; [! c
ns_marquee.left-=copyspeed
% Q* }" I* P; Q3 q( n# M; Aelse
; n& z' y& X" \& Y; w/ j2 x$ w# qns_marquee.left=marqueewidth+8 _' g) R" c8 m7 f1 m( q/ K& z
}
2 y9 m* a; l$ c0 l2 G}
* ~+ T {/ o) q' y3 q, m5 d: @1 W# s& w
( _1 | Z# y2 g; b, eif (iedom||document.layers){
7 [2 J8 e5 [* P* J8 vwith (document){ ?% ]' ?! |9 l! D% b& o$ L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& O0 s+ {: j* ^: K* m8 U. u+ pif (iedom){* [! _; U2 A: A/ S5 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 `3 T8 I% z0 x% U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! L; }+ q1 k; y# X" c0 j" L- C7 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ |) q% L) |$ w( qwrite('</div>'): v1 m; j" M4 R( h. d
}0 e- f( R G+ w+ X; E6 W) B$ R
else if (document.layers){
( I- x# C* X! {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 l1 x% y& z+ K4 t- awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); u0 w3 O, o. q# U5 C {# t0 f+ B
write('</ilayer>')) k7 ]' \0 t) B' p Y" m, ~
} c) M% G2 z6 J, g( ~2 T
document.write('</td></table>')& h' q& D5 D9 c) p
}5 ^3 }1 g& _+ H7 g% m1 \, I! I& ]( `
}
2 u6 k# z/ f+ r' g1 {7 g* r</script> |
|