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

|
网页之跑马灯文字特效
//修改宽度, Y3 E, n+ g9 G/ M' \
var marqueewidth=300" @! ~3 Y; `- R3 U& p
//高度
4 ~/ T4 b/ q* O& `$ dvar marqueeheight=256 d+ w4 o* ]2 `! Q
//速度(1-10)# |- w4 J; i1 S1 v$ g/ B3 k
var marqueespeed=3
7 Y5 e$ R9 s" P. o* ^//背景颜色" E- J1 t* r2 b
var marqueebgcolor="#FFFFFF"
) L/ J1 _! |* L3 e+ w; |: B//是否能暂停 (0=no. 1=yes)?" x1 e+ R2 E- s* U( j6 T' ^
var pauseit=1
& v$ Q- I* h! M0 y
+ H" r2 g$ I' Y9 |5 y$ Q//修改显示内容
0 E p1 M6 D4 d- G+ hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ j8 u6 a3 w9 R- w o
7 y7 k/ K; a+ j) ?: i
; i% S6 @ m+ Z% k////下面不需改变////////////
; C' S; c4 L8 E; y9 J
( ^, a: y) ?. V: P# Q9 z( f' F! gvar copyspeed=marqueespeed% C; ^% p5 v6 B
var pausespeed=(pauseit==0)? copyspeed: 0' k9 I k ^4 H% S+ Y; b- Q
var iedom=document.all||document.getElementById1 j; m( n* `; i1 q" U1 a
if (iedom) p: ?& C* E- \" m1 E6 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 t. p1 T8 Q; M4 p- R8 R" ?
var actualwidth=''
+ L* o* y( X4 ^0 P. h. [var cross_marquee, ns_marquee
9 x2 j1 b: E3 {% \0 x: h8 Q% ^6 _; p2 n# L
function populate(){4 Q* F0 ] V+ E* P X5 o# C1 K
if (iedom){5 N, Z0 p! f5 S; d& p( G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- y8 Z% s% @' u p j4 }4 |cross_marquee.style.left=marqueewidth+8
1 o7 W3 r D# D( \; i' _% Vcross_marquee.innerHTML=marqueecontent
$ K* x, M8 d, Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; \& I3 {& r+ ?" y2 K}% E7 Z* V7 [, j [* [ N; h$ u
else if (document.layers){1 f2 j$ U, y5 i% ]6 M) m
ns_marquee=document.ns_marquee.document.ns_marquee20 D6 l# w! b) o
ns_marquee.left=marqueewidth+8+ Q+ T* O! b+ R+ d
ns_marquee.document.write(marqueecontent)
; ~! w& d' i& x w5 fns_marquee.document.close()- p5 y/ | ^ G
actualwidth=ns_marquee.document.width
/ z5 w; _, D/ F6 Z}6 \0 y5 \8 } r* `# S& D
lefttime=setInterval("scrollmarquee()",20); d2 M" H- V8 T+ M# r2 j. O* A, Z
}
! B$ z9 {0 N4 ^4 ^2 J4 Uwindow.onload=populate' x* J" X1 M; S3 m
6 s6 ]+ k+ S" k6 V7 ufunction scrollmarquee(){
0 K- U5 K' t. aif (iedom){
6 @( I" M9 L$ g3 iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% I7 u- ^( k3 {9 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: \8 z3 J6 l* @5 |) y7 V) ?
else- f) ~' Y; S. k* Q h2 i2 u2 V
cross_marquee.style.left=marqueewidth+8+ M, W# f: h/ v2 t. j7 h: V; o" B& s
& ]3 G8 d! y! N. c}5 {& |% V' @& M7 m o
else if (document.layers){7 l$ L0 s$ T. j& @$ i
if (ns_marquee.left>(actualwidth*(-1)+8))% Y5 T* H: } O* ^: Z. L6 i
ns_marquee.left-=copyspeed
% ^, T( w& N5 W8 ?: p( celse
4 X3 d8 j9 U8 o1 [9 p# s3 Cns_marquee.left=marqueewidth+8; [! t9 w# H3 {0 Q- L. w" ^
}$ B' t! S) A* @$ |1 S
}+ G/ @" N+ |) |: \+ N c. ]' g
& q0 m! T1 h0 h- uif (iedom||document.layers){- f/ W- E8 ]$ Q$ l
with (document){9 ?& L* q( l' X& ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 m$ f# ]$ O0 w. {( F
if (iedom){) [2 l' Y* {8 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ w! B3 x: {6 j6 I7 I( \. C* I4 Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ @4 w/ G- Y6 z' v0 W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 i- @( y! C+ z" |! J \0 xwrite('</div>')* T: [8 B3 I' o
}
N B% H5 c' C! \else if (document.layers){9 M$ {! x8 d/ ^: P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 ?- j0 s5 [4 T& c: I* E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. V' t; f, g4 q* \, n% Jwrite('</ilayer>')
5 @0 X T2 B" f4 D6 ?9 F a$ P}
; t) X4 Z: V! M5 z+ O# ^document.write('</td></table>')* [* j4 `5 _+ Q1 u3 |7 i
}& ^1 E2 i1 h4 ? E" E" i7 n
}, J6 l; n/ }9 f# I* p3 w
</script> |
|