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

|
网页之跑马灯文字特效
//修改宽度8 b1 n3 w- y, M- R4 K
var marqueewidth=300
/ z/ b2 _+ d/ @& T" l//高度
8 ?2 z$ O; _6 u# `var marqueeheight=252 P! W' Y& ], ^3 D" }7 m
//速度(1-10)
. v Q, i1 L8 C1 P# i' J8 ~var marqueespeed=3
& U+ }5 |( p% E# x- r) h//背景颜色
% U3 Q0 O! g" F% y- v0 R" uvar marqueebgcolor="#FFFFFF"0 s6 D5 e: r3 v/ q1 t' |7 |5 X* z
//是否能暂停 (0=no. 1=yes)?
0 l ]; k/ i' _; I1 ?+ W1 Avar pauseit=15 s0 [' \, v+ C& U/ e
$ j3 d8 [( O" f4 @/ O- C* A
//修改显示内容
' z6 Y, D& |! ?5 f: | Q0 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 ` W7 b% w3 x z
, Y* B: k+ R. h# ?1 H. h n3 }! ~" d- {. P5 } [& l' i/ r
////下面不需改变////////////
m8 |- W* {$ d$ i2 ?- T0 O; p
7 o% a; c/ `( l' |2 zvar copyspeed=marqueespeed V6 X( f' S p3 y; |
var pausespeed=(pauseit==0)? copyspeed: 0; F- c$ n# A9 k7 R! c
var iedom=document.all||document.getElementById% `: k& w9 H" V& n
if (iedom)+ r; o( X1 A* l2 N/ o7 D5 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( l: p. a. E1 l& a
var actualwidth=''
& ^& ~; q0 s7 r8 s) q# |var cross_marquee, ns_marquee
: X& _% g: e+ Y
( M( [9 D* K2 ], ^function populate(){
7 l5 ]1 @; s2 M5 i+ A1 a3 eif (iedom){- L* F V0 p5 n9 A# P- _3 w9 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 M) B! p# R. A/ V6 J
cross_marquee.style.left=marqueewidth+8& y! q: x1 U% n- a$ g- \% ? j
cross_marquee.innerHTML=marqueecontent
4 N, R6 h2 H0 m/ ^. lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 z1 F+ K0 ?+ o6 m( I4 ?7 }}: J# L: H. I: n. b) f ?! e
else if (document.layers){* M+ g5 ?3 S2 e% u/ n+ h; x8 O' N
ns_marquee=document.ns_marquee.document.ns_marquee2
: g8 h) I& y* R# ?ns_marquee.left=marqueewidth+8! w$ b8 ?5 S, R* Q* W% O3 L/ O
ns_marquee.document.write(marqueecontent)7 O& H; }; _$ n) |& \9 W+ d% D
ns_marquee.document.close()
+ l5 r% M$ |4 o3 n& @actualwidth=ns_marquee.document.width* ~- H' k2 B" A0 x7 n1 K1 \/ \
}
! V/ r9 e; i4 T8 z! q/ E7 ~lefttime=setInterval("scrollmarquee()",20)5 ^; K8 @6 p# N! A4 ]
}
% E$ b3 G" x4 l6 j: vwindow.onload=populate1 F7 }0 d8 ^) {% D9 P
- J% y; h& s0 k5 u
function scrollmarquee(){
6 S5 t; f. M# X- G! O9 c- }if (iedom){
3 |1 y1 h5 Q/ v6 ~8 E$ i0 Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' L, K# [1 s" c0 A/ R4 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 k8 h* W/ G$ |7 k% _3 ^9 }else; }* M: K# }2 k8 f
cross_marquee.style.left=marqueewidth+8- r3 k; y, F! F: Z
7 Y: T; ]# b* J3 w# y}
8 ]3 J6 Z7 ?3 M! Relse if (document.layers){1 x% s1 X# y+ R" l9 n( ~: ]
if (ns_marquee.left>(actualwidth*(-1)+8))5 g: W3 A1 o$ i4 v+ C+ D- V! }
ns_marquee.left-=copyspeed
# g% A/ x0 M7 E) U- e) Velse
" p# ~/ L$ m3 m% w2 p: ]ns_marquee.left=marqueewidth+8
5 O. A2 [! A( z$ S1 N}
" J7 a" G' r3 k4 X}
4 @4 Z2 u7 P* T* }5 K/ R% p' S7 B e. v% ^, r# i( S+ a6 I
if (iedom||document.layers){
0 _8 r) x$ e/ }: ?with (document){! N' {+ ?: D# G& I2 G9 q" d7 [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# T0 R, P9 X+ e
if (iedom){: U2 @. h7 r! z p* P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) t I; O1 q b5 G+ O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 ?. S* I9 ~; d/ R) ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ r1 {/ [) v" x' L5 r
write('</div>')
3 H( \3 n1 p( V5 U}# R( e# S1 P! ^$ ?
else if (document.layers){6 n* ^& ~ Y9 @& l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 v2 r- A# {7 ~6 }& ^" f* y+ S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 q$ D; T- p' I) Lwrite('</ilayer>')
$ ]9 ^, k2 n- h, x! \5 P}
* d5 m1 Z, R! A: J1 q3 ldocument.write('</td></table>')# s+ Y! z. z9 G# @+ X7 w6 e8 q
}& a( T% q b! C- e
} {( |4 E- x- z8 a. ?
</script> |
|