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

|
网页之跑马灯文字特效
//修改宽度. y8 P5 `" p) R" n5 r% L% M
var marqueewidth=300
5 p3 |2 x- A! S5 b' B0 }" l% O# t//高度
Y% l% h: b: z2 `var marqueeheight=25
6 w' |: L; I* U! a9 o, d//速度(1-10)( B! r: l) h) \# I7 D& O; U
var marqueespeed=3/ x; n, ]3 B3 D' c) O* Y
//背景颜色
) j4 f3 u2 K& E+ o' ^" _" Z% Ovar marqueebgcolor="#FFFFFF"
/ a; s3 I8 v+ v7 c- B" u5 V//是否能暂停 (0=no. 1=yes)?6 P/ F" |- U1 k9 m- d( C, d
var pauseit=1
! p. g* i9 S6 X' e" k+ K2 d y; ~1 ^7 ^, O$ ]+ B' W4 u* K0 U- E8 R
//修改显示内容
% O3 W3 r" q9 w: Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 s) G6 Y- i7 o* U
( l+ I; J' y3 I7 u8 o! E' n- ^9 D& B: L; k T3 s. M i1 ^" Y8 q
////下面不需改变////////////
- B. I* E" m8 `3 V. U: o$ M, Q8 S2 D& q) d
var copyspeed=marqueespeed
* c9 ~2 A* `9 B" |3 ?! zvar pausespeed=(pauseit==0)? copyspeed: 0
' H2 B/ u/ V- ^- t5 lvar iedom=document.all||document.getElementById
- d5 U+ w2 l8 _4 G2 I# G [if (iedom)" r; C5 R# b5 k+ {% y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' F% y: m" C3 [% P
var actualwidth=''. c- G; P) A+ ~) t, ^6 ]
var cross_marquee, ns_marquee9 b! J: t: L6 j
8 J) z3 q4 b4 g; o% ~. T& o* j/ [function populate(){
4 s3 `3 {8 _0 @; G: wif (iedom){9 H: M6 [$ ?/ E8 m2 p) a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# B: _: }& q1 o% S, i
cross_marquee.style.left=marqueewidth+87 W3 N8 e9 E) F7 y, I: ?2 I( H/ i
cross_marquee.innerHTML=marqueecontent
/ M$ G$ w# F7 C3 a/ [7 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ h+ p( J$ b) P* U0 }1 T$ ~
}, S, d: o7 {9 V8 ^5 ?) Y/ M
else if (document.layers){, t, E- v& K+ p/ L5 P
ns_marquee=document.ns_marquee.document.ns_marquee2
& d1 H2 O* Z ans_marquee.left=marqueewidth+8$ j2 X. o0 _; T3 A4 q
ns_marquee.document.write(marqueecontent)
! J% ?4 Q% S3 qns_marquee.document.close()! I9 | U N& J
actualwidth=ns_marquee.document.width
& M# C7 k% u2 P- Q1 r5 q4 ?5 u5 W}
' G# E7 P5 k# O: V, r; Flefttime=setInterval("scrollmarquee()",20)
5 c! P: P+ S l}( E3 J) H3 u9 w. u l* E
window.onload=populate( H) o- N" |/ [- ^$ x2 j
7 L1 \& h$ q |0 |' j# ^0 b& `: tfunction scrollmarquee(){: X) w7 k4 a% z H
if (iedom){+ r" p/ P7 }3 {0 d" V* W. V, d# X3 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' ]% K' z2 l$ r- c% p0 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& Y: r8 V7 J( g4 e3 relse$ T Q$ r( j9 \0 y
cross_marquee.style.left=marqueewidth+8
& _- c" N8 J& q. V+ m: q. `3 i- [" ]7 W# r* |$ |
}
0 J: e5 j' ~/ P: d" U5 P# Gelse if (document.layers){
, Y4 c q0 s mif (ns_marquee.left>(actualwidth*(-1)+8))
8 P% C- H7 Q8 nns_marquee.left-=copyspeed& l% z5 z8 ?; O/ x
else
: r4 t6 a( l7 J( f# E4 xns_marquee.left=marqueewidth+8
# F$ T4 E3 O7 Y" B+ Z% d% j}4 d6 l- K6 b$ D
}
/ Z8 d" ]' e, H3 i* ~: K5 k- ~5 z) q+ k
if (iedom||document.layers){5 f. y& U& l& ?7 V! q8 v
with (document){, ]3 ~8 u' a* B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): G: `. c/ [& f. _2 ~, C; _( n" L
if (iedom){4 g, W6 Q( o: S4 O: ?9 t/ Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( l4 X9 _! F+ t2 ^# bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" Z$ k1 x, n1 F1 n8 {4 V- fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ T0 }6 q7 L) `( Q$ q( |
write('</div>')
9 u! g$ _ c- d/ E5 H# E- @}
# E0 E4 E6 z+ q9 W) y$ M. c# aelse if (document.layers){( I( A" B/ y8 F% F. _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% \) e5 E4 P& L9 \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( h$ `$ D: x1 a3 w: ?( X
write('</ilayer>')0 ^0 p% `1 l, ?& G, ~: m7 N: a1 N- s& S
}
; B- z4 H4 }& F, u6 V0 N$ V/ Ndocument.write('</td></table>')& e# g' b$ l: f0 V$ @
}1 y3 I; J; P9 h; |& H5 K
}
6 x2 z M2 j; j) S. z+ m+ T</script> |
|