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

|
网页之跑马灯文字特效
//修改宽度% r. Q; I7 }% ~6 A0 J1 K
var marqueewidth=300
9 E0 _( d# x7 n8 j4 d8 U. f( R" m& j//高度6 b7 f8 f' `- I4 q: i3 R# G
var marqueeheight=25
: [, O6 i0 R9 Q# v//速度(1-10)
# M" V; H" N6 U! P! lvar marqueespeed=3) f$ J/ z: w. {& y% A4 Z2 \
//背景颜色
2 J% }. R" F$ v& R$ Qvar marqueebgcolor="#FFFFFF"
& R; M( p N# `( h* D* H: W. i//是否能暂停 (0=no. 1=yes)?/ A6 V* p8 f0 Y) |6 c( D* x
var pauseit=1
0 l5 T( T; h* W$ r0 u2 q5 v( Q3 c' n7 y" j9 V
//修改显示内容! p0 {# l n: M/ |5 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 {3 o3 L) x9 t [9 I `, Q& B8 K1 G% b
# m! R1 f0 M% K# c
////下面不需改变////////////8 T( @' o5 J0 t
6 Y7 N& y" c$ V6 g9 y g
var copyspeed=marqueespeed
' V, B# L6 A: N$ r6 nvar pausespeed=(pauseit==0)? copyspeed: 08 z+ H. ` z$ ^ f q4 `
var iedom=document.all||document.getElementById
7 L q6 C% D, bif (iedom)
0 e4 ]6 v) F: [/ Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 e5 ?% I! P- B1 i' ?; Qvar actualwidth=''6 s/ ~- o" w. u$ b
var cross_marquee, ns_marquee* n. [' T# c. i U" D& r
) [0 E+ I$ ~5 C8 }4 a% y7 d
function populate(){
+ E+ i0 H3 K& {) Z, Iif (iedom){# k8 Q$ b$ l2 Y# z( x5 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ e$ J, Z: U' W0 |cross_marquee.style.left=marqueewidth+8" p3 l0 X6 J3 z: c, X Q( ?
cross_marquee.innerHTML=marqueecontent
9 `/ J4 Q3 O) a, `$ M, Q" Y5 J6 \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 H1 F+ m; o8 I! M# h}
1 `2 w* u3 _& L0 @. d6 a) nelse if (document.layers){
% }# Q8 i, q. x" t7 Nns_marquee=document.ns_marquee.document.ns_marquee2
: g ~6 _9 _) i9 M& v; xns_marquee.left=marqueewidth+8- d. l; @8 [. i* m" D8 e" D: \
ns_marquee.document.write(marqueecontent)) Y( H. ]0 K( T& b3 t
ns_marquee.document.close()" V) V% f9 M" y$ X2 U6 j, S: j: h
actualwidth=ns_marquee.document.width7 ]. J. _0 T" e
}$ @ m1 V2 y6 O* G) N
lefttime=setInterval("scrollmarquee()",20)
* E$ F# n! W. g7 t ^/ l/ a/ D5 {}
, U8 H3 U6 i+ j2 Q7 m/ iwindow.onload=populate
i, E- O& W! X2 W
2 }* w- L% V, g1 G) c7 k5 _4 k9 w$ X8 Dfunction scrollmarquee(){
2 ]2 m- c/ M6 M! \& G$ Pif (iedom){
4 u: \7 i- v' Z$ \9 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% t& e" Z, @0 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 O8 e6 k5 u+ Q5 m
else% Y& k8 x* M1 Q; s1 {7 p
cross_marquee.style.left=marqueewidth+8
: x2 f$ K. R4 Q0 b& {1 T' k$ N. m6 |" r" b0 E8 E, N
}* g$ Y' p# N0 V2 ~& s0 f
else if (document.layers){
! k" X3 s6 p/ ?; n( xif (ns_marquee.left>(actualwidth*(-1)+8))
, h6 K3 G3 N" e( l' Bns_marquee.left-=copyspeed
# {4 R( G" i9 H& ?else' Q$ c8 j! O x* K( F
ns_marquee.left=marqueewidth+8
+ J! f* z" S& @5 ? ]}& K4 D; `. t+ o: Y8 x
}
, d5 C O! k; e2 A6 ?$ x
- X0 D* t; H4 Lif (iedom||document.layers){
8 A4 [+ ]3 i, Jwith (document){' A) f& @' d, s9 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 I$ G1 f7 A7 ~! k; O
if (iedom){& w1 }/ M% W8 N/ k+ P) R' C X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" \% F& `( d. ~) Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); e$ m1 C1 _" d, A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 `# }8 _# @) A, k; lwrite('</div>')5 o0 K* y; P9 c, [& j
}" x K$ H* M! ^
else if (document.layers){
0 @5 o2 s, g1 h- S8 w5 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& V6 }9 F) k! r' d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% z7 \& G# o% o* s. o% R8 Jwrite('</ilayer>')
# Q) \: h P8 V0 U# G}6 w/ H1 Q/ i) s2 x! x1 B5 y
document.write('</td></table>')
) y1 J) Z( ]$ j" t# l" N+ X}
) m0 h' b0 N2 R- _8 M# @. F- H}" ]& F$ C4 C& Z
</script> |
|