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

|
网页之跑马灯文字特效
//修改宽度4 g" z: X" o2 L* k- R
var marqueewidth=3006 H; O% S0 ^2 _: w/ s7 q
//高度5 X) `7 A, E- j' b
var marqueeheight=257 x( e8 ~3 r$ F3 F
//速度(1-10)
* Y. q# I/ ]; C' evar marqueespeed=3$ n. Y4 X. V( g! \2 g0 K
//背景颜色, V4 H0 g0 N& `! A# d( e
var marqueebgcolor="#FFFFFF"
0 D8 S# e$ w/ }5 j//是否能暂停 (0=no. 1=yes)?
! T" Y' ]6 o) t4 ], @& j1 `* F6 M3 l" ~var pauseit=1
% s c9 p3 X. E4 Y4 G, H, u0 C1 u3 W" d4 U( n6 ?* c4 ?4 d m0 w
//修改显示内容
1 J3 o% e! \ R& l4 kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# R$ l1 F7 v- c8 o
# K c* P3 d$ c) V; V5 e8 B! C
6 l' Y' H7 Y7 m; I////下面不需改变////////////8 \0 I% ]) u! J
$ n. e* ]4 z: C, C$ w) L4 s' `- N
var copyspeed=marqueespeed
0 X; b! {6 ?6 }6 i/ @+ D* L1 qvar pausespeed=(pauseit==0)? copyspeed: 0
4 ^4 c1 Y( g0 k0 T! g$ _0 n$ v. s% tvar iedom=document.all||document.getElementById
0 n/ f) `2 O; L. w/ eif (iedom)2 W. `. ^; G: r9 O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 [/ P3 }$ @2 W; ^, [$ S! Tvar actualwidth=''
. N/ I. `% T8 Nvar cross_marquee, ns_marquee
1 J: ?5 y4 ^6 e1 O- k( Z+ B* |% c1 N( L4 X0 c0 E
function populate(){+ W, l! G1 h, j1 \; t# d
if (iedom){
. M1 r+ ]" `: across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' ]. w/ n0 f3 l7 K" x2 e
cross_marquee.style.left=marqueewidth+8: \+ X' V3 J8 q# h
cross_marquee.innerHTML=marqueecontent- N2 ^, \6 l2 H; `& l. ]5 \. j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ ? M# w, B. e" u& q& Z}
+ A5 _, S- r Ielse if (document.layers){
% I0 N# v& h ]5 O+ x/ @ns_marquee=document.ns_marquee.document.ns_marquee2, z& q4 Z4 ~0 u& F
ns_marquee.left=marqueewidth+8
6 C* `# P+ o" d: Z2 I7 i uns_marquee.document.write(marqueecontent)( L' g8 v# a- F# c1 ]+ p+ n6 D
ns_marquee.document.close()/ P) w! w: x" t T8 T
actualwidth=ns_marquee.document.width5 t$ z8 K' [" K9 S/ s; h! r2 N
}
2 @# Q- ~+ x, V4 U' ulefttime=setInterval("scrollmarquee()",20)9 z3 _2 h4 ?6 p5 A$ F: r* i+ x
}% J5 R# O p; B9 F Z, ?6 Y
window.onload=populate' {7 X# {# T& K- \; s1 v5 S& n" z
3 C) W( k) b' [/ v8 _function scrollmarquee(){
$ {9 g5 w; ~/ X1 u& t! ]! Bif (iedom){1 T( Z7 u3 N3 u% p$ J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* g; d4 a5 J* n% W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 p- U) F, F$ C+ C1 u
else
" @$ k3 e; x$ h- f( {% Bcross_marquee.style.left=marqueewidth+8, C4 |2 }/ z& B0 M$ I
0 f2 z @6 Y' g, h# F' {& y
}
' v' `; ]# t7 k8 O# ~: \else if (document.layers){
. X! I( S( n: V5 B; d2 mif (ns_marquee.left>(actualwidth*(-1)+8))1 S9 L4 B0 m1 M/ U) v
ns_marquee.left-=copyspeed# O5 j: A+ v! Y* Y
else
" t; d) |* m2 ]) ]ns_marquee.left=marqueewidth+8
# U- g3 d2 ?- j}' }+ B4 |8 t8 h3 s1 d% C- N
}
( D' G D: D0 i$ J; i; k/ Q" n# H" F5 T
if (iedom||document.layers){
+ y! Y0 L9 M7 b5 c# iwith (document){
! o' O( Z2 E, g; w q' `$ idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) D) z: U1 O! O
if (iedom){
5 e: ], k( _4 U0 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* t4 k! V: l' V ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( E- B$ `; ^. Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 ~/ T& q( c ?. Q9 N
write('</div>')8 r5 E, L( O$ `* Y
}; e& K- V# X* |* P2 T; a) @" b4 N
else if (document.layers){
4 q; n4 g; b$ m+ vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 S% }& K3 o# K9 q. }; t9 b. pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 \& I }% x! p: f0 M* y# [write('</ilayer>')
/ F/ i" j& o. T' ^9 a) O8 `}8 o+ I/ K, F! A* h& n* c
document.write('</td></table>')
5 ^5 D$ {9 C& P A( r8 i) t}; b& |& {9 r5 q2 C8 A. e* z3 M! l
}
+ L4 z. J6 P( ^0 ~' h; x2 G) M' [9 Z</script> |
|