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

|
网页之跑马灯文字特效
//修改宽度
y! T, _3 o4 c: k) d2 `# |+ ~var marqueewidth=300
+ `, w3 e7 O' p: ]! S& Y5 s- g//高度; L' q0 l" w! J) \' F
var marqueeheight=25
* h6 b$ O8 D3 b% }, h9 M# w//速度(1-10)( E" F3 n* A5 q; r
var marqueespeed=3
+ _6 Z& U; I/ P; N9 p, G) [ g0 b//背景颜色' e4 V+ Q& L8 `) l1 ~
var marqueebgcolor="#FFFFFF"* x% @2 J p# ~. x. f/ U \
//是否能暂停 (0=no. 1=yes)?
4 F6 h+ e. f8 B: Gvar pauseit=1% b; [3 ^# a) ?( P
4 Z R: ~4 C$ k& p+ k6 V//修改显示内容( N' d9 B B4 a( F$ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 }9 M( o8 M$ w9 r$ t$ X* R/ |5 [1 ~
6 A# e# z2 _7 H5 @
8 I$ z3 ^6 p9 k N1 c9 u////下面不需改变////////////
: m; V2 N+ y, |8 h5 f/ x. }
8 W' Y) O6 z1 S* K: Hvar copyspeed=marqueespeed/ v V+ @( L* f6 q# D1 X
var pausespeed=(pauseit==0)? copyspeed: 0
- h/ v; J8 Z, m4 P, e. ~9 S6 n% G* @var iedom=document.all||document.getElementById( j: x7 a1 r- N+ x" N. @
if (iedom)9 R2 l% L8 `% }3 B" C0 j+ |( ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& T$ X9 ~) W( X4 m5 \var actualwidth=''7 u) E9 H5 ?* B% @0 z: g3 M" u
var cross_marquee, ns_marquee
/ k" f7 n- J9 D8 M7 s0 f
, U" j U* R* I: j9 [: [, ^function populate(){9 [% Z J* \. I
if (iedom){
3 J9 d- V( l: e. E7 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ {6 E6 {1 }8 `. ]% R2 T7 G
cross_marquee.style.left=marqueewidth+8' Y1 d6 P" a$ P e1 }' B
cross_marquee.innerHTML=marqueecontent* u9 j1 B$ s* f( s4 ~0 H8 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ Y, u$ ]. [# @2 Y9 m/ O) B
} ], G- I5 r# @8 \/ O, |
else if (document.layers){9 ]) I( X2 w5 c4 c8 I& o2 _/ K9 [
ns_marquee=document.ns_marquee.document.ns_marquee2% q" B( t: d4 \9 o8 V! }8 D
ns_marquee.left=marqueewidth+8- [6 o. {0 Y; m7 q7 _4 \* p$ ^
ns_marquee.document.write(marqueecontent)
# j# Z- C ?: g! kns_marquee.document.close()
* c2 W( a; f- w( T2 f. A3 h5 Nactualwidth=ns_marquee.document.width
. a4 w8 y1 q( b}
+ k- [$ s' h) c2 S2 zlefttime=setInterval("scrollmarquee()",20)
$ o" m- R( P0 z8 g8 t}
) j& U/ z: H$ ]4 K( c% l1 O7 Xwindow.onload=populate
+ r6 t, [" D9 _3 r# r0 t- K3 Z* X1 V' P3 n6 I4 M* a+ R% Q* K+ J; r
function scrollmarquee(){
6 o/ m# a0 N& q2 o% pif (iedom){5 `5 W/ h# X _) {8 j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 }6 n. B7 Z, ]% _* @$ S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ ^% g0 G! O& g5 G. z; C% melse& e5 X3 i5 O% ^ W
cross_marquee.style.left=marqueewidth+85 n3 q+ h7 p9 T/ b: f/ u/ m }- M( C
7 K9 h* Y; p- q
}
* g0 R5 p" o# @8 g: x9 s/ q$ Oelse if (document.layers){
: n, L, {& C7 V3 Q- P7 G- ^) T- b2 Qif (ns_marquee.left>(actualwidth*(-1)+8))* L' ^# J: Z& t6 s
ns_marquee.left-=copyspeed$ `+ N# h) y9 v: {# \8 E, e- [
else( J5 i0 c* F- y4 ]$ `+ R3 Y* T# c
ns_marquee.left=marqueewidth+83 B) N1 T9 } I& B* D: j8 d
}
# I# ~1 [) r# O! z}
% @' c3 F( C4 h1 W y
0 z! f1 N9 X7 ^3 C: v( S Gif (iedom||document.layers){$ j) B0 V2 M+ Z! k* G
with (document){: l# C5 _: v) K/ F6 U6 X) L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 f7 d2 @4 \$ V; o N( Hif (iedom){* L. G' {9 r8 x. y; L1 d& R5 m+ S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; {7 k* `+ C' W+ H5 _ c# }0 Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), b' ?: o! ~4 h4 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 o8 W/ W. I8 d2 k+ B t5 W
write('</div>')0 |0 p6 b9 s) U
}
- y. U9 _) l2 W" b- R3 ?else if (document.layers){; Q! O+ E* g. q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), c' j- [, H" y. Q: D9 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 y' c, R$ b. V: I& v" w! F2 Iwrite('</ilayer>')
, K" z2 a* o; j}/ X# ^1 k8 n8 S
document.write('</td></table>')
4 B. k4 S: f" L& H' a}. e. ]2 J# G) k0 A. h
}
6 T' [0 G& G( C* E0 w" w; Y</script> |
|