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

|
网页之跑马灯文字特效
//修改宽度
( l9 F' q; m: z4 Mvar marqueewidth=300
) S* F1 c2 [* K//高度
8 E, j0 a T! D p2 q T& {4 X- mvar marqueeheight=25
6 n. i$ z9 m- I# M& [ q# a& R//速度(1-10)7 J, v1 C, {4 c/ C0 u9 @
var marqueespeed=3. T4 t2 S; N6 C; ^
//背景颜色' ~9 P( n$ ~7 w) O7 S0 C- c
var marqueebgcolor="#FFFFFF"
3 U1 Z5 V" b0 {" x! V( l% b! a//是否能暂停 (0=no. 1=yes)?
7 L e6 q# H5 c- \, f( Gvar pauseit=1
. T% _6 L6 x& w1 ` Z9 F2 i- e
2 c8 r/ `0 D2 \//修改显示内容
$ Q7 g$ m( Y! n- N# e4 Z2 `0 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* F0 {/ j, H9 ?! Q4 M
0 J: l9 E9 }& j0 A9 p% t& ]6 e5 g7 a
////下面不需改变////////////
L' a& H2 Z/ s' C2 G! b& \& t- C- V$ K' H( u+ ]% p: W2 `. H
var copyspeed=marqueespeed2 c& N9 d- ?: S) }* ` q5 h
var pausespeed=(pauseit==0)? copyspeed: 0
( L% H! O) l l' F- \% _var iedom=document.all||document.getElementById
! X9 m: s0 n+ e: u5 `if (iedom)7 e" B0 l1 F4 I6 Q* k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ C* o* C* e2 \8 F# B
var actualwidth=''- P4 b" a) E+ u1 N
var cross_marquee, ns_marquee
7 \! B0 ^. g) q% Z
- N* }4 c) x2 i& N/ Kfunction populate(){
+ I5 W; F' T0 S2 @if (iedom){+ a* L3 }5 [9 Z+ Q9 z8 U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 `' j4 }7 O$ `) Fcross_marquee.style.left=marqueewidth+8" ?4 C( P+ P2 b5 C6 }$ p- I
cross_marquee.innerHTML=marqueecontent
8 b' X+ h6 I" {2 p1 yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 e0 _* l! W- k5 q* {( s( U}
6 v8 f6 e7 B7 G. W1 Eelse if (document.layers){
- t* X! L8 I, q2 ^/ f) hns_marquee=document.ns_marquee.document.ns_marquee2: @/ ^: r) k3 }4 X, N$ }; K* b) o
ns_marquee.left=marqueewidth+8
3 v1 D0 A, n4 N0 |5 L1 i7 nns_marquee.document.write(marqueecontent)
/ _$ }" n# w8 I* `9 Zns_marquee.document.close()8 A' h- ?* V% c
actualwidth=ns_marquee.document.width
5 t" _8 K& h2 Y( a/ i}. N0 n9 P5 V h
lefttime=setInterval("scrollmarquee()",20)& E$ K! s; `7 S( E. L6 [
}
+ _) g! M1 @; N" a- ?( B. Twindow.onload=populate! g2 k5 `1 o: a. p
0 a7 l* V6 f0 A( s- C6 ffunction scrollmarquee(){( V, d) b" |8 j8 S
if (iedom){
6 M% c4 @2 y* M# k" `7 Y5 {" F' {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* h( X+ }' P' g& e' ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. S8 G5 G1 o( e2 Y
else
& {5 f' v) l8 Q. across_marquee.style.left=marqueewidth+8
/ Z- n! M1 \. G+ U
( O/ s( S# V9 p+ E! s: b, v}
0 o8 u- _4 |+ V2 R7 Nelse if (document.layers){1 O; e6 L" \. l8 r! j+ P
if (ns_marquee.left>(actualwidth*(-1)+8))
9 _1 N& N: O% ]- C) }ns_marquee.left-=copyspeed
9 F1 @) [& |$ Lelse
3 _% {5 L" s4 I1 c$ Ans_marquee.left=marqueewidth+8
+ ~! h* W1 E8 x" U}
- s4 X8 W$ w- n5 U% O& ~( B, u. s}
4 h' l- `& r4 \' H" [, W. B, v
& j8 `* D1 D, z7 m7 a. gif (iedom||document.layers){
3 i" r$ k7 K" l9 Hwith (document){- C/ U$ L. E7 T0 ^" G) W+ w2 Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 |; k! S4 ?0 q) ]$ w2 aif (iedom){# y" D( A5 }7 S# }. e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 Y8 H' g8 a& t& M- t8 k4 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- _+ X* U) l( J; E6 B/ awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& b, J# j* m' k3 H4 m( u7 F
write('</div>'), n% B# Y, m9 W; A( M
}+ q# j# w1 A8 G z
else if (document.layers){) Z F i2 G. ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 T; B' ~3 H* F7 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" `! t+ T7 P- k/ R: p; A, C/ S8 H
write('</ilayer>')2 u0 k- Q7 [& a/ |
}
C! Y, h% z: {0 l6 E" Y6 \2 bdocument.write('</td></table>')
1 r4 {' ~, {" @ R9 ~" j# P}
* c, w2 k! _5 {1 J/ B0 {2 u4 ~}
) F5 ]: Y2 B6 q- e4 Q% H* ?1 `</script> |
|