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

|
网页之跑马灯文字特效
//修改宽度3 U+ X5 W) E5 O8 q
var marqueewidth=300' Z2 D S- g" O% p& l) C9 u2 R
//高度; n$ A8 ^4 d" t; k
var marqueeheight=25- Z! R8 _% Q" h' j
//速度(1-10)
4 |3 i$ K; j% V8 yvar marqueespeed=3. O% g: G: J% F7 m
//背景颜色
$ W6 v0 \: A# ~) Tvar marqueebgcolor="#FFFFFF"
4 v8 G" a) X; j- S) h* m" w//是否能暂停 (0=no. 1=yes)?
% |# \+ | e0 ]4 n' tvar pauseit=1 J* C2 o1 o0 x# d
0 a) s$ ] j& c J3 b) H1 _# l( m
//修改显示内容! _' F" _! P& P6 C! b d6 ?1 G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 u( ?* k. T9 @' o0 j1 M' b# X
/ h' q* f b0 }4 E. R
////下面不需改变////////////: m" t2 x8 V2 ]# ~$ V% v
! g& D1 _1 E/ r) u5 }/ uvar copyspeed=marqueespeed" x% P1 J- K! S, h
var pausespeed=(pauseit==0)? copyspeed: 0 N* W; G3 t* R1 f% q+ x3 E- K
var iedom=document.all||document.getElementById9 T$ Q. B* X& J. l7 f( n4 a
if (iedom)
5 z& L: G3 B5 C, m `! Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- ]* Y1 J+ R: t# z3 h! uvar actualwidth=''
' @+ N% S5 ~# D7 V% R- z: Kvar cross_marquee, ns_marquee/ d% F8 w6 m3 L2 U/ D' x
. \7 U. t5 ^* X2 I4 y0 T! b
function populate(){
; X& v# q5 o9 vif (iedom){
9 A9 a b$ j2 ?! I* v7 w0 }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( U) D1 x- Q% o7 q! O
cross_marquee.style.left=marqueewidth+8
3 _9 c+ c/ P, n% Z, D, Across_marquee.innerHTML=marqueecontent
- c2 C" [ X/ F- Y6 f! p9 Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* L3 D9 R1 Y5 h}
, C/ T I7 d& I8 Z' eelse if (document.layers){
3 C' s+ M: G9 R2 T5 lns_marquee=document.ns_marquee.document.ns_marquee2) \6 U+ w# {( E0 U3 S1 X; Z
ns_marquee.left=marqueewidth+8
6 z! d, D n R" N1 Lns_marquee.document.write(marqueecontent)
# r) Q/ F+ P" \' M+ T e/ v9 pns_marquee.document.close()2 n. l% T5 L; l8 o& m* Z. Q7 H
actualwidth=ns_marquee.document.width
5 i- D) b/ _- p W' |9 L}
$ d) j$ \0 ?0 M; Wlefttime=setInterval("scrollmarquee()",20)
5 f5 w* P. |* h7 _' ^& W- q# [}) r4 Y4 l7 }4 Y* a% @8 H
window.onload=populate, U1 ]) s8 l9 L# }8 Y# ], D
2 E$ Y1 T6 Q4 O* {: }5 Ufunction scrollmarquee(){
l, D- a7 B' Y5 b+ m5 Y7 |5 bif (iedom){8 P, I/ @5 @2 Z) s) k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( t/ {( O/ j" M0 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 A: J' i, t( a) O4 }1 uelse
9 o1 z/ X- u2 Bcross_marquee.style.left=marqueewidth+8
+ v k' K4 r9 z
7 u8 v8 [& g4 Y* y2 @}* b8 q U" f8 s2 e, _1 h4 ^
else if (document.layers){
$ s3 C+ [5 K& d. E# o$ n: ~) }if (ns_marquee.left>(actualwidth*(-1)+8))8 w6 M0 U/ F! f( p3 K
ns_marquee.left-=copyspeed
3 h1 L2 P( Y) b: w3 p! Gelse
# R# w9 S6 T. E# V- d; D$ |/ C3 @ns_marquee.left=marqueewidth+8
, \1 c! G8 e) j5 [}. G" R5 P D: _* U
}
% l/ O4 \; Q' D9 f F/ [+ M2 h/ C. c' M } u! p, F
if (iedom||document.layers){
) H/ Z3 E2 h2 C- O2 m$ ^with (document){
* A' y) M/ u% v/ S W" Y: f, p& n7 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>') s; Q! W# j6 H9 w/ V
if (iedom){
4 ?$ E( e& V- M& r3 y5 L; {$ lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* q: v |8 z) m+ P8 e6 j' Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& ?2 c9 |9 c: _1 Z1 _5 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# e1 C! f3 I( L+ l( Q
write('</div>')/ s+ p& v% ]9 n& i a
}" v! e9 f6 k, H( H
else if (document.layers){
0 ?, z' n! s8 H& f: Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ s4 d7 _0 i5 Z) Z6 r, q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 Q! P" |( ]1 S9 [! u
write('</ilayer>')
! o7 L: g- V3 i. v% K. |}6 j$ M1 S7 n! d( Y! M; l0 U
document.write('</td></table>')* r( R9 Q! K( Z& ^1 \- H9 W9 j
}" o- z" z% E7 o7 f7 D
}% ]. d8 d/ Y! ?
</script> |
|