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

|
网页之跑马灯文字特效
//修改宽度2 ^/ s0 ?' }' o; [
var marqueewidth=300
& L% J5 }7 H; ]0 ^//高度. v2 }& | J* [/ ?/ o
var marqueeheight=25: e! x8 x6 F7 b, F
//速度(1-10)
) q5 a, E+ s: P7 P. W5 Rvar marqueespeed=32 B7 T/ ]) X$ `2 F/ X
//背景颜色9 C9 Y/ O) X# H' s) c9 }$ I- i8 f
var marqueebgcolor="#FFFFFF"3 B3 b; o5 E# J* _; c8 m$ A0 g
//是否能暂停 (0=no. 1=yes)?
+ ]! }' E9 _& k' \7 Z& avar pauseit=1
- {6 d4 P# H1 n; R! ^5 \- l
7 _0 i' U& r, w//修改显示内容! O$ F* |4 ^( n) q! I' q5 ?. N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 M& F- _5 m( N( R3 [" X, ?
6 D. @8 D/ A' r6 |' c* d/ O5 c! r# A
////下面不需改变////////////4 X+ d. T* h0 {9 P( |8 w! u
* C f( O" D$ A7 j' M9 evar copyspeed=marqueespeed; z1 [# Q2 P0 I- u
var pausespeed=(pauseit==0)? copyspeed: 0
* Y' {/ T6 A$ h1 K4 l5 J; Hvar iedom=document.all||document.getElementById$ z) {9 C3 a0 N( Q
if (iedom)
& {( Q1 ?3 ?+ L9 i$ d4 }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 C: u' _, ?: b4 F* A4 {
var actualwidth=''; R& U. J7 k. _' P! Q; p4 G1 f
var cross_marquee, ns_marquee7 @) c: T: I9 o# j, h
1 f/ @" r3 r- D8 {& }
function populate(){6 n$ Y* ~. d' E" C) k! Q& f# L5 X
if (iedom){
$ K1 P7 Q, d6 E) b& |) _6 e) across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( s& G' t0 J7 U9 E( L1 S" {. ^cross_marquee.style.left=marqueewidth+8. `' Q Y2 p# n
cross_marquee.innerHTML=marqueecontent
6 m0 U# d6 X$ K6 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; j8 N8 M# h+ v, S+ R}' K; w+ {# n0 C4 X
else if (document.layers){- x# [ S+ i6 R1 \
ns_marquee=document.ns_marquee.document.ns_marquee2, F' S: Q. L+ s1 s3 o
ns_marquee.left=marqueewidth+8
( V$ i, V, F+ A/ {, |. h) _ns_marquee.document.write(marqueecontent)
" m, [2 ^# f9 l- O( x9 Ins_marquee.document.close()# ~* z: A$ W0 Y. h
actualwidth=ns_marquee.document.width, y ~# s2 x6 R0 [9 h, P$ y
}
& {5 J0 I# W* k& Blefttime=setInterval("scrollmarquee()",20). o0 g/ Y) b5 _7 \
}, f7 m# u5 O% W6 M
window.onload=populate2 G w |9 b! g+ ^1 u) j
( }; s. P2 K @5 y9 @$ c5 }function scrollmarquee(){
1 {/ B f: S rif (iedom){
( e' `5 J( w. o& [& b" W3 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: s+ |, V; m) h% t/ pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ I% {: m- I9 e8 Welse
2 \2 b6 f9 q! V9 qcross_marquee.style.left=marqueewidth+8
2 t( v( ~* M* Y5 [3 i( i5 R* P0 _5 M+ Q2 W$ H2 A
}
- Q; L6 f; z) y- ^else if (document.layers){
' M9 i; ?( w, Q. ]' {if (ns_marquee.left>(actualwidth*(-1)+8))8 `+ y3 R$ j6 C3 u/ E% d) D
ns_marquee.left-=copyspeed
7 r0 Y( o: l9 a2 d: i8 I- Delse
2 I3 n/ a& N/ N U' Pns_marquee.left=marqueewidth+8* j% u3 I1 F, P8 K3 Y
}
9 \4 ?. ~* }5 @# y6 @( [}
3 V6 C6 K( |; ?
! _, M# K$ B7 Q$ Vif (iedom||document.layers){2 q4 c4 X1 N1 ?$ D5 I# X
with (document){8 T) E4 k8 V3 o7 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. u+ M* K D6 jif (iedom){
0 S& x& E; f" N6 h2 K6 l/ {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. {, z& u& T& }4 awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' r+ R+ m* A# A9 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 r/ D8 m( q( o
write('</div>'). G% I4 g9 k9 L. N# X
}4 M# c8 y; U+ i0 p. O8 m
else if (document.layers){
. h8 \4 \/ m7 s; t7 i6 Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" x5 R ^3 {. Y1 s8 N7 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ \9 \5 x4 ~# Z, A" G3 pwrite('</ilayer>')
# V F" l6 a% W2 o! [' G% n8 X% U}
/ r4 R% ^6 @( y4 N! k8 Adocument.write('</td></table>')
# k* V; ^. J4 F6 B; F4 g}; J% f o/ U6 h/ f5 g
}& |0 e. o: G G7 v6 j- P
</script> |
|