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

|
网页之跑马灯文字特效
//修改宽度
0 ]* ^7 v/ e4 O. a4 A9 bvar marqueewidth=300+ T; H1 V4 J, x+ Y
//高度6 n; ^- S. V) P
var marqueeheight=25
% ^2 v' i2 u# C t$ `+ ]//速度(1-10)
. B' w/ c* z' m8 T: \1 n! X; uvar marqueespeed=3
" i$ Z+ r) x" [9 n# h! Q" C//背景颜色
$ L4 ^) Q. _8 m! X" x( ^var marqueebgcolor="#FFFFFF"0 d1 E2 N+ P0 v
//是否能暂停 (0=no. 1=yes)?
1 i1 ?. Y( N* D$ G. a8 jvar pauseit=16 Y: d: c% ~" O4 o4 X
2 R: P" Q0 Q3 y' X% k
//修改显示内容- l6 Z3 n4 G' |# J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 n6 g9 @ H$ \( X4 X/ n; b, @1 a$ Z( m1 [
" Q: f5 [' H" y- D////下面不需改变////////////
6 W% ?) ?% r' ^6 l( u
l0 E9 Z- o* f; \/ c+ i# zvar copyspeed=marqueespeed# P7 W, P# T- q4 j( @
var pausespeed=(pauseit==0)? copyspeed: 0
t7 ^' G/ j5 U0 C: Fvar iedom=document.all||document.getElementById
w i6 d) @. r! d, s4 J' Z+ Mif (iedom)
; `# Z3 J2 h5 x; T/ V* ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( M1 U7 m5 m7 u" I# p3 J+ t0 `
var actualwidth=''
6 R) D! \" r |- xvar cross_marquee, ns_marquee
$ t1 c1 x8 k2 E9 K: T9 B2 t _( j2 S/ a
function populate(){1 t+ T' F* X: U5 s! G- c5 q
if (iedom){' D! v6 w4 Z: L. ?! _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 N7 `+ z7 G3 u) C% W7 U/ |
cross_marquee.style.left=marqueewidth+8% V( s& }) s0 Z K* Q
cross_marquee.innerHTML=marqueecontent
( X! S2 g" a/ `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. v1 V" o7 Q% A. D% h- U* W5 w}- p6 G8 m; {' ]( N3 k- F, i
else if (document.layers){9 G$ G$ U" g, v
ns_marquee=document.ns_marquee.document.ns_marquee2
; z' D/ \2 T$ s2 Jns_marquee.left=marqueewidth+84 b$ F; J* b( l) a3 w/ e6 x Z, y
ns_marquee.document.write(marqueecontent)
3 G" Z) H7 W: ?+ ?" i3 Xns_marquee.document.close()
L/ _2 o2 a( w; Y0 Nactualwidth=ns_marquee.document.width
" L. j; l# q, ?% Q% A z}7 @' d% ~3 ?, r" \1 k/ X
lefttime=setInterval("scrollmarquee()",20)4 W& ?, [. f% t. ^
} {4 u, _: t* h' q: m O- x
window.onload=populate: a) V9 l& x$ a& U$ W l
7 _/ F& D; j# q7 y& @
function scrollmarquee(){
+ t) J! x: Z1 eif (iedom){
) L: s* B/ O/ a3 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# {9 V9 Q; E9 I/ K/ |1 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 k4 y8 b% @% K* h8 r3 H8 t
else- @) N) E* s* k m
cross_marquee.style.left=marqueewidth+8
) _% ], y# s* g. z0 k) n$ R9 S. Z" o6 o
}
# F, u/ h% F$ R8 helse if (document.layers){
5 F1 I* f( n7 ?% m. q' oif (ns_marquee.left>(actualwidth*(-1)+8))( q: y& N3 `: N$ X
ns_marquee.left-=copyspeed
$ \8 |3 u3 M" \4 X$ ]else
3 M7 [4 K5 A% t7 {ns_marquee.left=marqueewidth+8
5 R# H6 s! v6 T0 a( n. I}
- u, M! {4 S+ y8 G& F: S/ ^}$ S! ]) N$ u8 r; k6 ~- p" x2 Y. ~
% u4 B' K5 R8 b5 Z5 B+ @if (iedom||document.layers){8 q" l, a* P9 H$ G7 T
with (document){: a: ]$ P* h& d7 H7 n; U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 |/ N7 t- y1 U, S$ J# bif (iedom){0 Z+ X3 b+ [9 V( R3 M+ P% s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% X' V9 U$ P! T, l% z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ V. C$ G8 ~! h6 q- owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 t; Z' v' T2 ~( ^! X! Cwrite('</div>')) ~' X3 K: C/ d7 ]* q
}3 g0 T) o, c! [8 t4 c7 t
else if (document.layers){7 s9 M5 \2 B; M F) \) {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 u8 H- a7 A! B; m5 r( E1 \+ h! F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). L( K+ C% R4 X* }
write('</ilayer>')
' I0 y. \* N2 U" _; Y}
9 w" d% c$ M: n; I2 E6 S& E& Cdocument.write('</td></table>')
- Z: @8 r. x3 e' a" M; w8 @}( g7 W/ o I0 h" r
}6 {5 x/ k/ B9 Q* J; U8 N+ V0 v
</script> |
|