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

|
网页之跑马灯文字特效
//修改宽度
( a/ T' T) I% z: {0 Avar marqueewidth=300
- M. y& |( S C, V# r//高度
9 ]0 h5 t4 `. z. \/ h2 E tvar marqueeheight=25# a+ u$ g% k% h' b' ^: I h) @
//速度(1-10)
3 W* t" o; h( ]) E8 \var marqueespeed=3
) o$ N8 z9 `. n9 d: {7 \ ^2 Z& s0 j9 t//背景颜色* V) ]8 [' m& {0 J
var marqueebgcolor="#FFFFFF"
7 F( b3 n, c& r//是否能暂停 (0=no. 1=yes)?
! H4 ?2 d4 i6 o g0 g1 dvar pauseit=1
+ k& \+ k- ]8 l* V6 c
$ A% O0 V4 B/ q2 o9 S//修改显示内容
3 e4 F, h P: `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 u4 C" q4 h: [7 n/ w8 {& x: r8 n' M
7 C4 O+ n0 ?# e4 f////下面不需改变////////////# m. p' x$ I6 N G- {9 b1 z
9 A) E( v' c7 a; V# m1 k) T+ _
var copyspeed=marqueespeed
8 g5 w W6 I; e, T& ?var pausespeed=(pauseit==0)? copyspeed: 0
4 g- b8 k3 t; h& b, g' J7 K# }% Gvar iedom=document.all||document.getElementById, G# p8 \) m5 n+ k% M
if (iedom)4 \0 s% @* W! X6 u( n; Z4 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( s" l9 E3 |2 ]7 U. ^2 ovar actualwidth=''
# k( ^! h& S/ ]7 `+ f% b) @0 Qvar cross_marquee, ns_marquee
# M; T1 P* k0 y( F3 S- w" V
; p0 Z+ V# `$ V+ Q7 ?function populate(){. Z/ H4 S+ W2 O7 C
if (iedom){
7 N4 ~4 N# V- ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# H5 U) U8 b5 S" c* Z$ q
cross_marquee.style.left=marqueewidth+8: W4 C+ _, ]: A- G' T' `8 y* y/ @
cross_marquee.innerHTML=marqueecontent
+ _. |, ^2 X# Y" U5 D5 V9 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ P+ L9 F7 A/ @9 f
}
* U" z/ {5 U) L+ r5 U, welse if (document.layers){" N/ l5 _: ]5 h4 ~
ns_marquee=document.ns_marquee.document.ns_marquee2
% j* v& U/ C" a* [2 D6 N/ a. q9 S. Hns_marquee.left=marqueewidth+81 R9 r# z7 L1 p# _$ k# V) x
ns_marquee.document.write(marqueecontent)+ l; y t6 ^ P8 `3 R8 G
ns_marquee.document.close()
1 |! Z6 b( L% ^7 j, T7 a$ Sactualwidth=ns_marquee.document.width; b1 o8 J" D1 e
}; J+ f5 y1 C3 x" j6 ?) I3 y: P
lefttime=setInterval("scrollmarquee()",20)3 Z1 ^- U8 v, J6 w. f' c
}
6 B2 `. N3 `' v$ D1 [/ O) vwindow.onload=populate
4 f- x- z* ?: G* `
% c! o, E% `; |! _/ Q& ]. D$ qfunction scrollmarquee(){/ G7 L' d, ^( r
if (iedom){ h E; ~9 c& @: T% H' A9 n. p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ p0 f. c; k1 L/ F3 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 N/ a) f% @+ B" C9 Aelse! p. a5 L% [1 Y( V
cross_marquee.style.left=marqueewidth+8
; s4 t: v+ z8 z E0 p$ C& B' k( H2 Q0 S7 X" e. e% }
}
4 k; v& Q2 ^/ T+ c6 _. Jelse if (document.layers){
, v+ J( f2 T+ A" a- eif (ns_marquee.left>(actualwidth*(-1)+8))
1 w( g! C+ x$ l. S0 B0 O: d) Hns_marquee.left-=copyspeed
' A( j) `& D5 t1 [0 kelse
; X/ s( m$ n; C; V; w w) k0 R8 T* ^ns_marquee.left=marqueewidth+8
5 A- n3 H5 t w# c. E- L# x}
8 T. b/ }1 l1 ]}
0 [- h% E5 ?: w, Z" G- N0 Z# |# T3 ]8 W, n# T) [
if (iedom||document.layers){
$ y* Y4 s5 }+ Q) `with (document){. E3 N' i% X4 D' g# k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 A8 e4 y* ^+ g$ t7 J2 T2 l3 w
if (iedom){
/ z6 L# L, I, dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& ~1 q% \& i0 h- |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# @9 g5 \! s+ j: \" h& a: q. S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 H/ v2 Y" F8 |& }* s: v
write('</div>')3 o9 o7 }3 m% Q q. L0 W) j
}
E) X$ l1 R3 d( [/ A/ X; v" lelse if (document.layers){5 T! r/ ?$ J+ x. D* A- v9 a6 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 `* q8 I: R& W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ v5 o( x1 X. Q0 C+ W" p2 J5 Qwrite('</ilayer>')
& Z/ J( t5 x @- y}
6 X: B) h8 e- N7 C4 @, ~* C) b" ~document.write('</td></table>')1 o9 c) s$ _6 j
}& a/ V: A7 E q5 Z1 q4 K
}
4 D2 o9 P" k, C# B) f* m</script> |
|