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

|
网页之跑马灯文字特效
//修改宽度
/ h" O9 U8 [% `var marqueewidth=300
6 r$ N9 p8 e0 j+ k! j( o2 J; ^//高度
( b8 j3 p% r: ?0 T6 ~# mvar marqueeheight=25$ E( m& j3 h$ _# D8 g9 F: P" Q C- H0 N
//速度(1-10)+ }. C6 t. E E& C
var marqueespeed=32 m5 V9 v: v0 q. |4 }
//背景颜色. c6 O$ K& `' @$ _0 A6 ?( @+ A! Q
var marqueebgcolor="#FFFFFF"9 Q& v, [/ E$ P: v
//是否能暂停 (0=no. 1=yes)?
3 k4 l% Y3 @6 E" hvar pauseit=1! ^% N7 h1 p" p- w
/ ?' m5 A& {- o& x2 R
//修改显示内容: `; J: B& f( l' L, v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 P+ {0 P* S# p5 j3 Q! M9 a; D
8 ~. J( q8 o7 l* ]7 G5 W: P. Y
2 P# B7 _$ h4 F2 K; \- q9 n6 x0 k* c////下面不需改变////////////
/ C( h6 Y! u& p1 X. R% c, _. C+ G% l' z/ z5 |2 M) t
var copyspeed=marqueespeed
8 l: Q2 [# F) ]$ x1 U7 ^0 cvar pausespeed=(pauseit==0)? copyspeed: 0) D) L! }) ]4 S& g. L5 Z, L% M
var iedom=document.all||document.getElementById6 D( ^, r! R8 ]$ d
if (iedom)+ J6 {/ J% z8 V6 R8 V3 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 h! D0 i; f* B/ D* F4 zvar actualwidth=''* b4 x. s3 c' i8 l4 R4 z. F
var cross_marquee, ns_marquee
/ H9 V& J0 U0 l/ ^& {' h7 Z. ^3 O4 i8 i/ F! \& g" [7 m6 P, S" k
function populate(){8 s8 s/ q, H5 Z: v
if (iedom){
9 S+ R" k( r1 x$ U- i$ Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( B) U1 T6 M- ?$ ^cross_marquee.style.left=marqueewidth+8
/ _3 T' z. w7 }- tcross_marquee.innerHTML=marqueecontent1 l: j) k2 ~! G7 Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! s. V! Z. X" T0 S
}
/ S* U. Q- R& Q/ Z! \2 k4 selse if (document.layers){' W0 P) N O ?) L; P
ns_marquee=document.ns_marquee.document.ns_marquee2
5 E$ a' j! `4 s% Mns_marquee.left=marqueewidth+83 i; r3 p. M$ t |
ns_marquee.document.write(marqueecontent)+ D8 ?* Q$ L! Z/ r' j# f1 M
ns_marquee.document.close()
9 G2 n) J+ Y- W e) z! Gactualwidth=ns_marquee.document.width
! W9 m+ c6 i+ K" G7 I. Q" ]( p}* L! I* k$ v* ? f: K# H
lefttime=setInterval("scrollmarquee()",20)
9 c. d7 m! D. k0 `; @}! j+ z7 b2 A& z
window.onload=populate
' l. }& r* a; C* w+ k* S) K" v4 H: z9 j1 x5 m7 G/ @$ [/ \5 K7 W% B
function scrollmarquee(){3 i, S! Y# I t- a' z. s
if (iedom){
* Z/ ]! M5 j- }$ \" h9 G( g! @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ w$ m- i3 J- J across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 q I. O4 W m, ^8 x5 Pelse
5 G# p6 Y4 t: J4 qcross_marquee.style.left=marqueewidth+8
/ }0 e* d! H6 J, `. [6 D* a( H* Y
1 `& z2 M9 s3 Y6 p! }}4 m9 T5 g" t1 c3 U
else if (document.layers){
@! A, W5 @) |- O& P0 K+ g( ~if (ns_marquee.left>(actualwidth*(-1)+8)); p" r8 {- m% p- ]0 `
ns_marquee.left-=copyspeed
) L. @4 y: B0 t1 X" g7 [) Pelse
. [; Q2 z7 x# z* X$ Jns_marquee.left=marqueewidth+8
g! o# J; ?8 R0 S+ s' ]}' O* } J5 |1 O) F7 K& r, |8 P5 ]
}/ b. |+ p1 {; _
8 x2 E4 V/ H! u2 H2 J8 ~) pif (iedom||document.layers){
( @( C3 X0 Q1 ^with (document){3 G6 |* P7 G# O. D$ \, s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% k; H8 l" p9 G, \
if (iedom){) v- y! q( A1 a- f5 J4 J" F) @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* R: J2 Z4 {8 Y+ ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 C* p5 ^9 O/ n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& A* @7 U1 s& u. J9 P
write('</div>')( @ q" S2 K) Y) I9 w# P
}
& d: ^1 F3 A# B) t2 L q6 K& Jelse if (document.layers){: i2 x4 }5 n( C& P1 {: u: d! j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( O* a8 H( [" `3 q' S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& v' C6 D/ ?+ ^
write('</ilayer>')
$ X/ R2 [; r L' o0 D; `: \}
5 ?) N1 i5 [" E; L* \document.write('</td></table>')4 \3 o" y; r0 p1 u2 I# p) S( T A
}4 J1 ?5 l, z N- u m
}
7 Y) A- O) @7 K3 ^! M5 N) _</script> |
|