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

|
网页之跑马灯文字特效
//修改宽度( y( J- f+ y" a6 K. a% T$ p" h
var marqueewidth=300
1 D) J3 T* w7 z9 m& y) h5 y//高度( m+ C0 L2 i5 ]0 K3 k1 k
var marqueeheight=25
# r0 i+ s" n3 O//速度(1-10)
/ }! I+ e/ ~+ R! ~/ e/ bvar marqueespeed=3* R. I' d. C- V& f- ] k: O8 a- \
//背景颜色/ v. C M$ o/ s
var marqueebgcolor="#FFFFFF"/ v. H2 ?1 T, `; M
//是否能暂停 (0=no. 1=yes)?6 _/ G/ w+ Z! O, V0 I& o
var pauseit=1* K3 `& [6 K, R# r$ Z) [0 H
, ~+ |1 X7 G9 M//修改显示内容% ^3 r5 `' N0 {# G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. c# p" { j m7 a) l! F9 W
[& \/ g \+ F8 u" U
# T- I( ]1 ?4 D+ \
////下面不需改变////////////. h, o. Z$ q" G8 W/ |& c4 s
( c C8 r) }! g
var copyspeed=marqueespeed( o8 l% { f& `3 J
var pausespeed=(pauseit==0)? copyspeed: 0
; F/ a# p9 ^9 r9 ]& b8 c: Y0 fvar iedom=document.all||document.getElementById
9 W L A% ]% k3 m7 Pif (iedom), @& r5 G( t) f4 b! C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 L, y7 L% z4 j; w/ a
var actualwidth=''
) X) F/ y) l0 ]; xvar cross_marquee, ns_marquee
m. }# @6 u, v0 j: R" _/ \* o! P
/ g6 K5 \: M8 }4 T1 Z$ Bfunction populate(){
3 k- q, c( p4 Jif (iedom){5 K' L4 m5 X" V6 {& L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) f, l- D) g0 S, m7 G/ {cross_marquee.style.left=marqueewidth+87 V% \# h3 H7 @9 {9 l
cross_marquee.innerHTML=marqueecontent* l5 \, l) y. J& U3 W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
B5 f, J# Z3 g, F. `- c2 x! F}
0 O5 P, O. q7 s2 telse if (document.layers){- I# @$ X. f5 U4 N0 A: s( m& O
ns_marquee=document.ns_marquee.document.ns_marquee2( A6 y) w& V$ e+ b6 w! l
ns_marquee.left=marqueewidth+8
% [: {/ v$ B5 q* L7 _# r) Tns_marquee.document.write(marqueecontent)
1 c* c8 |2 L% L* `7 ons_marquee.document.close()5 y% ]# p4 s7 @/ }3 j2 O X& e
actualwidth=ns_marquee.document.width
H! \6 |( ]3 m& q5 n. i}
- Z/ H; ~2 r2 c3 `9 vlefttime=setInterval("scrollmarquee()",20)/ z' T" k" @ l1 h' q V) e* e
}
; F' I$ A& o/ S, f8 u: x4 E: Rwindow.onload=populate6 j! ^; D+ v+ ]. S
7 ?. O4 H& f& |
function scrollmarquee(){
2 `9 W3 ^# p- v6 e' O2 Mif (iedom){
# N# _0 m2 f2 ^ \7 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' [* y- } r" f Z3 R" w; |" Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, L/ E7 Y( h& b ~' belse
+ ?& z9 I$ M" h6 lcross_marquee.style.left=marqueewidth+8
, ?" H/ R- o1 O! j7 ~" ~6 _
- F _# F. s8 I: i' C}: L6 s! V& \; Y, I( n! ^7 W( Q
else if (document.layers){
: t" B" P1 t# k7 ?3 X9 ^. L: dif (ns_marquee.left>(actualwidth*(-1)+8))
d* }+ l1 i) r$ w+ cns_marquee.left-=copyspeed
5 `) h& h% ^( ^1 j$ M6 p4 belse0 }; R$ H( b1 f
ns_marquee.left=marqueewidth+84 x7 o. d4 V+ G: e6 J. ^
}
0 j; b1 M) T) Y- o% j/ h}
( d! }4 H0 g/ M# t' w0 H- Q4 |- k$ u$ y. J
if (iedom||document.layers){& d( X! B( a$ ~2 [9 H) T
with (document){
5 W: e, {* Q; F# {8 g! {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 P5 U; a, ~: J+ T& Oif (iedom){5 o: `) y4 m7 c# \) E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& q* r2 q1 v* M. w1 o6 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 c* |% I: m% c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 {! ]- w8 ?- d. t, a
write('</div>')
2 W# @! q7 Q3 }% q2 Y: Y}* P9 C* K+ W2 a6 u
else if (document.layers){* P. J/ U4 B; b% J h, Q. F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 |- `8 x. @) I: y1 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 e% B& B/ f8 y8 [, J" |# h5 T! \+ {
write('</ilayer>')0 c+ G0 }! m, _' ^
}# k* T7 Q3 @; G0 e% @) e# H
document.write('</td></table>')' W5 F* z* Z: U; L1 B
}* g- Q6 Z r" E, g9 q- }
}: K7 [6 D$ F. w* {- g! x9 z' V
</script> |
|