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

|
网页之跑马灯文字特效
//修改宽度. k4 r, c; F6 J9 R% _4 r. N9 D
var marqueewidth=300
$ V# G' t" B7 y; `//高度5 q1 q1 x8 x _
var marqueeheight=25
! [1 s* G2 y5 P3 B//速度(1-10)
1 i6 P! s0 X+ o' r( T6 u1 r- Svar marqueespeed=3! ~6 K- N6 L6 e1 }& X8 j
//背景颜色7 i' l' e$ a u
var marqueebgcolor="#FFFFFF"
! {0 V+ R$ l- I/ g//是否能暂停 (0=no. 1=yes)?
t& ]' ~0 b4 L1 ]5 t I. H& Rvar pauseit=1: c7 E9 m8 T& Z8 m
2 t; N3 T" u2 ]9 ^0 W1 G! L
//修改显示内容
8 {9 k3 b5 u6 u. ^3 ^1 @% s) kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ D; _( G) f( d- E% _
Q/ S7 S$ }- E% t, X* V" C* O+ V' z' r
////下面不需改变////////////# P0 x+ j! I. F* P
0 o+ e# ?" e+ H8 H$ W
var copyspeed=marqueespeed2 f* I: L) N+ l4 ]6 `
var pausespeed=(pauseit==0)? copyspeed: 0
. y: W- z' G: h. Mvar iedom=document.all||document.getElementById7 T( r0 q' _* m i) ~, @+ |
if (iedom)6 h: D% _' i& T% U# g- Z% D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# r/ F- Q, {6 Q, L; R8 Evar actualwidth=''
' B' [3 u8 z: H6 ]: ~1 nvar cross_marquee, ns_marquee! R/ b5 h2 a7 B6 z9 C* L
* a1 O; x; F; s9 E' D+ ?( d; N" Yfunction populate(){+ V# H5 ^) k: f, M
if (iedom){3 d6 G( _* }# s* `* y, R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ n# m% H2 E+ s$ t
cross_marquee.style.left=marqueewidth+88 ?4 d# L2 }. ~) r+ z
cross_marquee.innerHTML=marqueecontent. i3 D( Q0 s6 O! o1 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 L8 _) E8 j" U' A8 Q}2 O i$ I( t9 b/ }
else if (document.layers){5 s' F1 a4 g9 j! z/ s
ns_marquee=document.ns_marquee.document.ns_marquee2
* I3 w$ u' N7 b4 Y- B$ q1 pns_marquee.left=marqueewidth+8
% W* Y1 n" ?7 e, |. I; ins_marquee.document.write(marqueecontent)
% U9 Y( w, J' t9 C4 z) j7 s( i$ Q9 hns_marquee.document.close()
8 C, u7 b3 T+ Q2 o' yactualwidth=ns_marquee.document.width
4 ?9 }. \. j- c}1 L- l9 S5 M4 @- k$ j
lefttime=setInterval("scrollmarquee()",20)& u9 P% [0 H5 E0 u7 ~
} \+ Y) x# O2 y0 I( v
window.onload=populate7 ]! s+ w/ i/ l
6 B5 a; \$ ?! v) S. s0 D6 _function scrollmarquee(){, Z! b4 I5 C: Y: l9 Y7 Z
if (iedom){
# @* p! h, N% h/ O/ ~* U% Y8 Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% W, E! i3 V2 ~" f8 g7 _: I3 z* v+ D6 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; Z) a& b) L$ Q6 x% R+ X2 a7 @
else
# z% U+ w1 E/ {8 R# G9 Bcross_marquee.style.left=marqueewidth+8# O2 F( f, C* E
( P* l" r1 ?1 P1 g b7 [) o) ]7 Z4 J
}
/ }" l. U7 i) U! melse if (document.layers){- I. q# a) f" T5 [2 ~6 @' v
if (ns_marquee.left>(actualwidth*(-1)+8))
! d7 j- Q( H& r5 G: E# n0 |ns_marquee.left-=copyspeed
X5 [& m( w. o: Aelse3 L1 d) p# g, H/ i
ns_marquee.left=marqueewidth+8( w" t0 a R- M3 S# L' }% Q6 [7 g
}* e( B: E- u m
}
) Y% |& I- p8 }( ~& W9 N7 I/ T$ a* o8 X5 H3 p# K! C
if (iedom||document.layers){' ^$ g. C3 b( ~, D
with (document){, J, U& Q( y0 j* V' ~. M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# d9 o; L) Q2 r1 W+ G8 Sif (iedom){
" z( j/ U' U9 S _. Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( k) d Z6 R* y. ]4 N7 p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 `% y9 W) J8 s1 ?1 U) t: S' Q( i# }$ nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 O1 x6 u, q. v/ Z2 j6 r v
write('</div>')4 M2 v) Z) r4 }, E1 T
}4 U0 F9 F8 S7 ~5 i- q5 g
else if (document.layers){
- V h6 [, R, ~* ]4 Y0 c# X5 I0 _" Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 u' r. W/ |: d! q$ d" y: ]) K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 [3 y) v1 S* ~" @
write('</ilayer>')
! L4 J* ~2 ~9 r7 m}
4 `6 f' ]9 `8 A- I4 _; ]document.write('</td></table>'), D3 b+ \7 N! B
}* {( |3 w8 Y$ d! L5 n. l0 k, e
} }0 C, X3 P; D, z% Y
</script> |
|