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

|
网页之跑马灯文字特效
//修改宽度
8 o; h5 ~ \' ~1 c0 ?* c ivar marqueewidth=300
) u F! {2 F6 G( q//高度
6 M. x# u3 ~3 f/ I2 G- k- zvar marqueeheight=256 b; A6 R. _& _. u8 E; g6 M
//速度(1-10)
; D5 H4 }3 o( T3 S0 zvar marqueespeed=3- g+ n' W4 o# g$ W
//背景颜色& t! ]7 _; `+ U* Y) c0 |
var marqueebgcolor="#FFFFFF"
5 Q, @, o K" b, ?& f( Q! ?//是否能暂停 (0=no. 1=yes)?
0 }+ Z0 r% T+ V9 tvar pauseit=1! K. {7 G- G [
) {% Z5 a* d2 c/ {+ b
//修改显示内容
4 x0 ^( @0 b z) _; T8 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- k4 K4 e0 h \+ o ]
% y- [7 A2 J) [" \6 w; K$ ?; r8 J6 W7 O& m' T8 ?
////下面不需改变////////////
' n/ h0 T O: c3 _ H2 _7 f7 v9 \( s/ D3 `6 a5 B. w
var copyspeed=marqueespeed1 Z1 p/ }! `2 V' _5 f9 S
var pausespeed=(pauseit==0)? copyspeed: 0
+ }+ I3 f% B s3 X4 y9 ]var iedom=document.all||document.getElementById* @! X' n! R) c# G3 B
if (iedom)5 p& g, i9 M: I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" y0 \" Q# J( A- P5 ~var actualwidth='') ]4 ^0 w: {. X& {6 Q1 ^- @- i8 ]* ^
var cross_marquee, ns_marquee% ~0 a' `* H4 D7 g
$ G5 `3 e- Z1 U+ cfunction populate(){
% i+ Q# r- B! `; _* q1 Zif (iedom){& w' I- ]) J9 n9 T, h3 [- Q* ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 X" j% {3 \' w; _0 x
cross_marquee.style.left=marqueewidth+8
* _4 B! r( W0 J4 n: }; ecross_marquee.innerHTML=marqueecontent
3 F( [8 Y$ }) k0 E6 [* p4 p Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; C& \0 C# t% }}
5 h0 B0 j r; Q* l! Zelse if (document.layers){
6 E; a) d% ~8 A. Dns_marquee=document.ns_marquee.document.ns_marquee22 ?' p1 H' u( p# M' @& H2 q
ns_marquee.left=marqueewidth+84 _; v" V7 H; d b' `! _
ns_marquee.document.write(marqueecontent)
$ v3 k7 I& v* C0 D$ qns_marquee.document.close()1 ~1 }* S. y7 |/ @7 R6 M2 t
actualwidth=ns_marquee.document.width& B+ J# e, S2 q5 V% M9 _* K
}( t v) Q6 q& \
lefttime=setInterval("scrollmarquee()",20)
5 }- u S; h% _2 `$ B- B/ a}
. D; r; x0 B9 l# ^! o: a' |7 qwindow.onload=populate6 Q8 J4 G; F/ {4 O, r, G; w
6 e# x. W5 m4 t: M0 ]7 a4 F: ~* x1 _8 s* qfunction scrollmarquee(){
6 L5 ]# z9 p$ k8 Xif (iedom){8 x, A$ \) g ~7 ?3 u' Z, V* w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! h, j p) _1 n# P8 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% Z5 G5 Q% z z) T Selse
* M" k5 u0 U9 B# i" T( vcross_marquee.style.left=marqueewidth+8
2 V% T I+ f7 B2 C; D0 Q# ~
4 c0 E( v9 H8 e" J0 i}
1 Z. q9 P# m; [+ nelse if (document.layers){
( x, a9 [+ g- K$ tif (ns_marquee.left>(actualwidth*(-1)+8))+ f( J% d. b( T* b Y# K! t
ns_marquee.left-=copyspeed" {$ ]+ {$ G& w' q% r) p! R. h/ B
else
8 B- y3 _; J/ }2 I, [* c' Ins_marquee.left=marqueewidth+8 u/ ^$ ]4 q" r2 s4 A# V8 n& I. ?
}
: y) y5 M) u9 N2 t2 T}$ d4 X4 I0 S) k
$ z1 ?0 h, N) w
if (iedom||document.layers){
* x$ c8 y0 D8 rwith (document){
) ^& x% l2 B% p- S& ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# e, |7 x8 \& q) t' p8 cif (iedom){: n4 i: ?7 P! ^% t( s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ M. V' [$ S1 V* K0 @' dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! y, B e$ S' U0 f$ b# X' [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ P( F* h$ T2 [2 b
write('</div>')
3 d# ? t- i; k6 \( {' t+ f}
0 h- [) R6 G; w3 B% [else if (document.layers){' I& P6 ~' t; k7 r' ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- e2 m \5 i) i. z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 N' f3 k' s+ |# m/ p
write('</ilayer>')1 V3 [. |* e' s1 S' M4 l/ Q
}
6 l. k1 K, q7 s) w( Xdocument.write('</td></table>')
* p. \$ p# q6 M8 w: m}0 K5 P; p+ Z/ F5 A k* @
}, U0 ~/ Q( S. ?: z2 e
</script> |
|