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

|
网页之跑马灯文字特效
//修改宽度, k8 ?+ N P; d- R1 |
var marqueewidth=300
$ z4 L; j8 h5 o! a) V//高度4 u; X7 a0 Z- Y1 E, r
var marqueeheight=256 k6 G% r: i8 _6 ^+ y" q
//速度(1-10)
6 B2 V9 Y% X5 D+ p' n8 Bvar marqueespeed=3, U; C) A4 Y) _0 h/ M% ^. d
//背景颜色
/ x1 C2 T: N" O( k) Y2 lvar marqueebgcolor="#FFFFFF"; l+ ~0 A3 _- w& }) [7 `, v6 d( E
//是否能暂停 (0=no. 1=yes)?9 t& O8 Q' B2 P2 a$ a
var pauseit=10 u5 x! B0 e: F+ f
# G9 G, M% t( X. y
//修改显示内容
5 S9 k( Q2 Z% [% p. mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( {( F& P5 V1 z# E
( l0 ~1 r' J5 m- H: r9 g, Y) e
% d& x9 Y. u& Y4 f////下面不需改变////////////
& t& D/ ?3 s) ]& y
. u( q5 U9 W* G# U5 @3 t) evar copyspeed=marqueespeed* d$ U: v" L' n1 A, S
var pausespeed=(pauseit==0)? copyspeed: 0+ R0 b" R4 `/ `. u& [% r
var iedom=document.all||document.getElementById- g J% L, o4 Z$ c( _% v% ?. ~) g
if (iedom)+ a& u2 W- q# n! l2 k# ` f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 C# \8 o& c" p0 Zvar actualwidth=''2 D2 ~7 H. Y* m9 I- O. w. D: P% }
var cross_marquee, ns_marquee+ L( I9 x, h% w& P1 m
) V8 {$ L/ Y% Y `" l& Wfunction populate(){
8 \( M4 f3 W ~- `if (iedom){; r( G8 N; d" t6 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% J# L0 h* k! x$ @" F( R' H r# I
cross_marquee.style.left=marqueewidth+8
; r1 G! [ i4 @$ d H" Pcross_marquee.innerHTML=marqueecontent. Z' i3 G" h1 G6 X3 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 J. X* Y' D& Y}
' S( w, \6 r9 o% A( Xelse if (document.layers){7 ?! ~5 O1 a. v7 r: m
ns_marquee=document.ns_marquee.document.ns_marquee2
; S" ?; A/ D1 r6 b4 Dns_marquee.left=marqueewidth+80 t% f6 ?; y! `4 M
ns_marquee.document.write(marqueecontent)' Q Q2 S" `! Q$ i
ns_marquee.document.close(), \) }5 c5 ]& i3 @; u- s9 |
actualwidth=ns_marquee.document.width
% Y3 M) L8 g0 O}# l' X) I) ^; M( Y ^2 h0 i- j
lefttime=setInterval("scrollmarquee()",20)! S+ ` l2 d8 _
}
# |& n5 r1 d6 @ b( I! H7 Wwindow.onload=populate( N+ B9 @9 n4 Q e
% d* p) p$ _/ r
function scrollmarquee(){
! S3 \1 m1 N1 g; pif (iedom){
+ }& T) H' i- H6 @$ K8 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ E$ I( k" i/ y4 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( p$ _ q$ C0 Y. ielse# G7 `) T; X2 o2 b( o5 X- y" i7 r/ s( l
cross_marquee.style.left=marqueewidth+8
$ L2 E E+ w1 C% f: b- b5 }& O# |
/ |( V$ B# K. ]! C$ j+ p/ s}
6 G0 e7 j, G9 a% S) Felse if (document.layers){, ?3 [1 p! R1 A9 {- D
if (ns_marquee.left>(actualwidth*(-1)+8))* @- V6 _& o$ v2 V1 \, ~0 P1 G
ns_marquee.left-=copyspeed
7 k/ [" F: {/ I: Felse
; h; V( l8 j' o! C9 ]! c nns_marquee.left=marqueewidth+8
( ~; m% Y% T7 |}
6 g$ ?. {9 W" d}: J6 R% ]6 ]1 o) m
+ k5 {+ I. Q6 u9 o- jif (iedom||document.layers){
7 E, \4 k( G! v9 v! G# `with (document){, J) f9 |$ I/ e: {% U9 T3 J5 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 N* ?: s' K6 y. h3 L6 y% t; Jif (iedom){" i! |" |5 P# h; M# m. S( Q* E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" |7 Y: z* k& i# ?: N1 }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* ]+ `3 O, Z$ g) p+ l G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' K% G8 i- d4 ]; ~+ c& y9 owrite('</div>')/ J+ N$ D) _' V' ?& J& P7 P
}( q C4 v5 X0 v" b( G" t. o3 g7 u7 p( G
else if (document.layers){, }3 i2 P% Z# t/ S/ q& U+ z8 w1 r: y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 x4 b8 N" c& w8 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ u: y5 _0 F& {! J: y* Xwrite('</ilayer>'); S& K" l/ q" l/ U$ } X
}0 x3 b8 W6 l, g
document.write('</td></table>')
: D5 T& J ~+ p3 s/ ~}3 z' _8 c7 d9 L/ l7 w4 U
}
( T# y, ]6 I! Q6 L0 }* z3 K</script> |
|