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

|
网页之跑马灯文字特效
//修改宽度7 G! {" i7 z( k) s$ d/ d
var marqueewidth=300( V1 O6 j% q8 ]: J3 z" t7 n
//高度
8 U0 d" z6 ~6 t) W, nvar marqueeheight=25
: b5 \+ c4 W8 n6 X& ^" O- t//速度(1-10); l2 G9 g- L% \+ r
var marqueespeed=3
, }6 p' w! M' `2 i% ?' Q- a//背景颜色) C' ^! k9 E) q
var marqueebgcolor="#FFFFFF"
. R/ U, [% D% u; D* ~//是否能暂停 (0=no. 1=yes)?
9 A; ]) S* Z; g9 K' a# L/ Rvar pauseit=1) z, d- b* M/ K! Y
9 d* E5 e5 J+ t- f' F
//修改显示内容5 T1 B% Q: h- r% x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': i+ H2 {4 }6 ^7 w+ c) |
6 N; z; q! _) y. \
3 r9 T" x# V i- k2 Y% O: v////下面不需改变////////////7 W2 y o& P% L' E
m( [- r) F) I4 f# \& j) N, |var copyspeed=marqueespeed
9 Z0 ]1 M0 ?3 O' h% }var pausespeed=(pauseit==0)? copyspeed: 0- Q7 }4 u3 o. Q
var iedom=document.all||document.getElementById" |' h7 m0 O; s% }
if (iedom)
% |2 J$ }/ Y- f, E) xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) I. L) i; H( W& l# W/ M
var actualwidth=''! W# S! b5 g) E% H9 V- z
var cross_marquee, ns_marquee
' [* P' M( U8 n- `. t* E, {7 B8 |
6 j4 `+ @2 a- u' s: u- tfunction populate(){
% {# C! \, E# T6 z" Nif (iedom){5 I& C% Z) ]% C/ L2 L1 A' `+ I+ [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 w, ~$ X: R* L2 ^. i$ F
cross_marquee.style.left=marqueewidth+8# N# j+ K4 b+ |% m) e" P
cross_marquee.innerHTML=marqueecontent5 u( U5 }3 ]3 s* i: e' |9 v6 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- x/ f# {; u, k1 [9 ^}
% ]/ Z5 _. ?: i, gelse if (document.layers){
( w& a* ~1 Z4 {) e$ Vns_marquee=document.ns_marquee.document.ns_marquee2. V: n% [5 T* R0 \+ [/ _
ns_marquee.left=marqueewidth+8/ q; k7 [1 L5 l! b( V5 F i
ns_marquee.document.write(marqueecontent)
5 t, k2 P0 [/ {7 a, l4 n, \ns_marquee.document.close()
) L! O( H5 n3 o# F7 d) cactualwidth=ns_marquee.document.width
3 T& d0 U3 }/ m$ S$ J} S/ X( j, i$ v b+ P: t7 `; v
lefttime=setInterval("scrollmarquee()",20)
/ y& |3 N" y+ f}0 d) h# O2 R% P' C
window.onload=populate1 z# e) j; {" D2 z( J
: s* O- e& A& T0 j/ |
function scrollmarquee(){
! u- ~2 B1 d! }4 i& J: O8 M- d! \7 g+ xif (iedom){6 }# S3 c& Q/ Q3 Z0 y& e) d$ k+ D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 ]8 _; m4 v6 a# h, C* i1 D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# v: |% I3 b. c6 Q. Nelse
, y s. [8 {5 qcross_marquee.style.left=marqueewidth+86 P6 s; }: @* ~
' R+ k; x; q' f2 B}2 b/ f7 w: B7 |) z, A- p
else if (document.layers){
6 U/ t& P! |8 a. N2 t$ v2 wif (ns_marquee.left>(actualwidth*(-1)+8))1 J% d A% q- L4 }& q: T# T
ns_marquee.left-=copyspeed
& R, h x: s( }0 jelse: z: _# X: }" s9 x+ c
ns_marquee.left=marqueewidth+8
" e: U8 Z4 d& ^+ Q' J( @} m$ \4 o' e/ X. a# a9 W
}" S& `# }4 `0 w$ C/ [+ d6 F+ @4 Q
# L! u g7 r+ ]3 v# ^9 I1 ~9 v" q
if (iedom||document.layers){ ]0 D Y& `8 g+ Q% L! w* a
with (document){* |6 d$ d9 u, o" @% b7 l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) V" g; d5 d* Aif (iedom){
" `; l, t) k0 j" Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
|2 Q* T& f4 ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% }0 C! O- Z2 n% s' x/ F, Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ z: k* P4 _% |6 k& y& t6 B
write('</div>')0 S) s0 Y$ i" J8 d F7 l* G' D
}
7 }6 N9 r. J. K3 D. E) O! q/ Aelse if (document.layers){0 c% p" f" i$ E( p8 i: _" N/ k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% ]4 n4 k. g* v! k1 p' `1 G2 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ c0 [9 r+ v4 V* k
write('</ilayer>')/ Y, D9 \# Z4 j2 x( W
}
7 j/ m7 T# u& C" L% Adocument.write('</td></table>')8 q4 {4 s/ Y/ X' r5 g4 B3 l6 `# z
}
F; n/ w/ @' f: M9 x! p}2 g0 y }! i7 p. n
</script> |
|