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

|
网页之跑马灯文字特效
//修改宽度8 W4 Q! T. j2 [0 _2 R$ d) R
var marqueewidth=300 K# X2 p2 M8 `2 z$ D
//高度2 ^7 u' N4 `. x; `) j! Z
var marqueeheight=25
c% P0 C! q) G+ _ j//速度(1-10)( t, O" r& Q7 } _2 E
var marqueespeed=3
2 f) s' R8 y6 d1 i3 X# }5 |* i& K0 y//背景颜色2 }/ e% n* c; y& [; i9 m4 q6 T
var marqueebgcolor="#FFFFFF"
^0 v4 r* U& N7 S0 J$ E! C9 R# C//是否能暂停 (0=no. 1=yes)?
4 E( v* b) x: ^var pauseit=19 b) a2 C9 e3 @: N% V4 Y8 S+ ]
, ?6 l& x/ o/ u. K7 ?$ `, q//修改显示内容3 i. i0 U9 C8 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ K; Z3 O1 j1 R, j# U9 M9 ], ?
0 K( Q- m% D/ h5 m+ {* z7 c
" p# A' }4 p# [0 p6 |9 r
////下面不需改变////////////2 J! L2 y* {! _7 z: U8 ~' Y
& j3 N+ x, r( H! l' |6 `
var copyspeed=marqueespeed# F6 n4 G. \0 r% p+ w4 \- @; C/ I
var pausespeed=(pauseit==0)? copyspeed: 0
: S0 [: v2 w3 Pvar iedom=document.all||document.getElementById1 p3 U7 |8 A ?- Q: U& o$ z' X% t) y/ T
if (iedom)$ e0 }; U) B6 i% `1 n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' V0 E% I" X7 O" N0 |3 k' W7 m+ ~
var actualwidth=''* ?: F% X# w$ W5 m* L" g0 P
var cross_marquee, ns_marquee
8 y* k/ Y0 R- L6 F+ |% i( a1 w6 }& B2 b( v/ K6 ^- d- i) m( V
function populate(){2 T( a" U h6 \ R/ b! {
if (iedom){
8 L! v5 q) z8 n' N% mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, y. `2 ]9 T- V3 e! B4 }6 G
cross_marquee.style.left=marqueewidth+82 a( Q/ M* M0 X# H2 L/ |
cross_marquee.innerHTML=marqueecontent
: ~( x8 X9 K2 Z; g# y& p1 ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; f; o. D$ C. v# T
}
8 _! _0 v3 h9 j1 n9 k9 F7 d7 eelse if (document.layers){
5 M( C) k, m! Z1 \& F$ T& ^# p/ Sns_marquee=document.ns_marquee.document.ns_marquee2
0 r1 b2 {6 L0 a) `: `, K- Dns_marquee.left=marqueewidth+8
4 Y7 b0 A/ K* t# X c: I- Cns_marquee.document.write(marqueecontent)
" ]4 [, ?9 a1 |/ R# j4 a- J! Q3 bns_marquee.document.close()2 E" W% y1 m- q' ]9 l0 h
actualwidth=ns_marquee.document.width
; C" q7 B5 e+ D% r0 J# k! M- U9 Y! ^ Z}3 {' B$ U: J9 Q4 I9 u, \
lefttime=setInterval("scrollmarquee()",20)
$ \6 {) f( H9 C6 a! B! j}" ~" n& p/ o" ^( E2 m+ y' T& l
window.onload=populate
+ m5 a# w+ o1 {5 `; v Y3 |* ~0 A- d1 w, v9 Y5 ]2 H$ f9 j5 f
function scrollmarquee(){/ }$ s+ Z8 N* V1 S
if (iedom){
5 |7 o+ b0 I& V9 m5 `* N' d) cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 J1 Y& ]) ~5 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 A4 V2 v' G5 y. ]+ B0 F2 B' Gelse
; H/ c; n! R/ K* v& V5 [cross_marquee.style.left=marqueewidth+8
4 |. w+ d/ a* i3 K0 V8 ]6 V7 j' V& |* V
}7 y3 a' S7 Y9 s: K5 k0 g" d0 v( C
else if (document.layers){
4 m% ~- P1 [. r8 w5 T: I& b1 ~if (ns_marquee.left>(actualwidth*(-1)+8))
1 r6 A4 f. F/ }ns_marquee.left-=copyspeed2 n9 ]3 p' }( E, }( I: O% a" i
else# g1 i. z8 ]9 E+ @5 |
ns_marquee.left=marqueewidth+82 b9 O; a1 n% [% x1 x5 o" L
}
9 j- h Z! k8 _0 _7 `; O}8 X6 P0 s' V* ]" R3 Q2 X& E; |' M4 i
]0 e7 ]8 C* Q/ O, U: l3 j( @if (iedom||document.layers){
0 P+ t9 U$ @" Kwith (document){! g* r6 g- W: w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 m; a) X6 i! e$ L2 q6 B6 B3 v9 R
if (iedom){/ {9 L6 {- g, E1 e3 k3 R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) ?3 o9 k, Z3 { O/ Y" |% qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; {5 b6 g# _6 ~/ n! V) Y, xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 P- s C( h8 R7 ^& z9 t% _. s" xwrite('</div>'): C$ g% x( k- n" [9 X4 J3 }
}) o# X% p. Y0 h. g$ D. S6 O
else if (document.layers){
/ U( Q i; ?3 B/ a& S# }5 ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' H! c1 U' F8 dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 \, Z8 e. J6 i2 Bwrite('</ilayer>')9 g' k6 J7 [& @2 h) F; D. E
}
( i, I: @7 j) y( U+ Jdocument.write('</td></table>')
! e2 Q; p, _ Z9 i}2 L0 d+ i; ]. }! M6 N$ f
}, D6 x5 ^/ G' z8 F# G$ t1 }* L
</script> |
|