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

|
网页之跑马灯文字特效
//修改宽度" C; O f3 i* H l
var marqueewidth=300
. t1 J; a* v# p# B- S//高度
- `7 ~& R% h' N: z4 y8 tvar marqueeheight=25% m2 b) X: h# l
//速度(1-10)" Y3 b4 {4 a \0 y4 B
var marqueespeed=3/ h! G0 j1 E1 k: c+ }) C: |
//背景颜色
% Z* G( d( B; L/ q& N- ]. Avar marqueebgcolor="#FFFFFF"" A% i" l$ N* t6 n$ ?
//是否能暂停 (0=no. 1=yes)?
K$ \' K6 X. X9 U Rvar pauseit=1
8 Q" B) B0 B' c$ Z4 P: T! T- C
, i( O: v2 N2 s( H$ O& v; p//修改显示内容7 T( A/ R9 w2 {% C3 R+ z5 @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 ^) _& i* h7 m% D7 }+ a$ K* e1 W
1 D9 x% j0 C9 q# H+ O////下面不需改变////////////
8 Y0 @2 f! S0 s; l4 |
& m9 M5 e# S7 e) }9 @% hvar copyspeed=marqueespeed) L2 `6 W& n0 a, a1 M
var pausespeed=(pauseit==0)? copyspeed: 0
' Q! N, D6 G) V* Evar iedom=document.all||document.getElementById
; @* w% O( p+ Iif (iedom)
7 e2 ?! @5 s* pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 M; i# H) C! Mvar actualwidth='': f. T0 j8 o; n
var cross_marquee, ns_marquee
3 m6 v! F& N. K3 m( }
5 z4 ~# G# k, ?; N! i' d6 } A0 Yfunction populate(){
% @, |4 t7 e5 `6 Iif (iedom){( N& r+ z/ ~3 {8 R# Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) l) p4 S; }% a; a0 Zcross_marquee.style.left=marqueewidth+8
7 N1 V. O% J( Tcross_marquee.innerHTML=marqueecontent
1 L) p# W+ ?6 Z& |0 @0 ~$ ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" K% h5 y# E4 L- h/ a# W4 [* z
}3 h2 p* p! y9 ?3 c
else if (document.layers){
. w3 M' T1 R9 z% v9 Qns_marquee=document.ns_marquee.document.ns_marquee2
0 y" k% `, k7 x. N( r1 e" Vns_marquee.left=marqueewidth+8
! ^1 r% E4 z' q, K0 Dns_marquee.document.write(marqueecontent)
8 _' @* d; \' G; \7 w( l- A( Yns_marquee.document.close()3 g/ H) P) m' P6 Q- g; @* Q: D5 I
actualwidth=ns_marquee.document.width
2 G; E. v: D' P, Z& r- h# B1 b}1 H. I6 ~! V; o- O$ V. e
lefttime=setInterval("scrollmarquee()",20)6 {2 T, v% v" |' ^, X9 i( `
}
W1 L. G- f3 s* g. z4 c1 a% p5 H5 Awindow.onload=populate
& m: f% v% s5 q/ H9 a5 C6 d
2 m1 y7 z7 o& g% |; |/ [function scrollmarquee(){/ S9 k: k5 X6 s% z' |6 J2 [
if (iedom){
, j: P1 }5 G3 h# E% |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- Q% x u8 L) t8 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' G! t3 |8 D+ T& W0 ~+ _
else
/ A% y" q0 n% r& v& T; Hcross_marquee.style.left=marqueewidth+8. y$ K/ V$ d/ c) W! W- \$ B: S# X% } ]
- {# w F5 f; {# D' ]
}. k- V- N( d% v5 [
else if (document.layers){) Z! X* n8 I# ]+ ~! f
if (ns_marquee.left>(actualwidth*(-1)+8))
4 o" K h( U* o( n: `2 `& _ns_marquee.left-=copyspeed1 e3 T0 J# O$ O5 O# e2 U
else
# M& O; ?1 L7 W% b8 B9 ans_marquee.left=marqueewidth+8
1 a ]8 T" h4 e: E+ U}
% t) a# u9 k R8 }/ @7 A2 p}" o/ |. Y+ A( i' D
% G9 p4 J$ P/ y4 }5 Xif (iedom||document.layers){
6 B& X8 {" B. l/ ]with (document){
2 J& p; Y" L* F# u; l/ n; bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 t5 I# V, L# b4 S5 z$ t* _9 y% V. mif (iedom){
8 \6 K4 Y- i5 c3 Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 }) J- _. }5 ]" P/ J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 H: [# W& j( s1 i4 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# h4 t$ P( k8 f& Y% U+ `3 v
write('</div>')
6 u: S/ a y9 z2 U}
- h6 [ v' U; M- J( Pelse if (document.layers){
' [3 v$ G2 ]% }% E: a. }$ Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); w* s$ ~2 S* T" K! M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 _6 H8 W/ ~; c& W, x+ C8 i
write('</ilayer>')
) ^, P5 N; I2 q9 j; ?0 j! r}# i: J5 Q. L# v* r' _
document.write('</td></table>')6 g I+ N+ O& ^* d8 _6 l. {0 g# [# F
}0 r% a$ H8 `6 q0 z$ R1 _* k! i
}
) W9 [ _3 f7 w: z, d4 a</script> |
|