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

|
网页之跑马灯文字特效
//修改宽度/ V+ y3 u, v- I2 _0 r4 ~9 w+ y8 s
var marqueewidth=300+ p: C5 B @/ d& Z- ^3 G
//高度
2 ^; k" ~3 L! wvar marqueeheight=25
1 O& Z( g; o3 l) ]//速度(1-10)
6 {+ l; `) j0 B" K: H$ e8 Pvar marqueespeed=3
8 \9 l) p6 X* o+ A4 b//背景颜色
) S- j8 S& d9 |6 x0 Jvar marqueebgcolor="#FFFFFF"
! C# V. z( q/ |9 S//是否能暂停 (0=no. 1=yes)?" @# R8 G4 z; |; k# ^* j
var pauseit=1
: k7 q% Q1 J* }9 i+ G0 T0 M! m# b3 i8 z" z1 z+ V j# l
//修改显示内容
# u# e) S7 {# P; B! Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: J, t1 L, b/ i1 ?6 P% W) p1 J$ m: Z" o
( l. Y( }6 c% o/ T+ Q, m////下面不需改变////////////
+ h1 _: Y* L9 |5 S. T* }; R
1 _6 D+ x; `' p8 E% P& Ivar copyspeed=marqueespeed8 x- L, h5 Z( H
var pausespeed=(pauseit==0)? copyspeed: 02 H+ `6 h- k" b. G* D$ D
var iedom=document.all||document.getElementById
* r" O3 T5 u+ _ W% h* pif (iedom)
* H, d9 O: m; _; Z# V3 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): c' d W+ @/ l9 q4 a/ T, G ~
var actualwidth=''! }. A' u. Q* R
var cross_marquee, ns_marquee" a' ]4 d: Y$ L: M
! W% }% l) H# Z0 k2 |6 v
function populate(){
8 A( O! L! f; [ z3 f5 dif (iedom){
$ ] F* W& Q1 _9 Z3 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' }: H7 Q" y u8 I; Y( ~
cross_marquee.style.left=marqueewidth+8/ l& ~& G8 I9 M3 `, Y2 v0 C9 E" y
cross_marquee.innerHTML=marqueecontent" h& x ^" e2 ?) s: C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 Z7 C& L/ h/ r8 O4 [5 ^
}
, c+ h8 c- T! q ]- T2 Aelse if (document.layers){# p: i K) ] y) b
ns_marquee=document.ns_marquee.document.ns_marquee2
6 u8 G. F7 E0 C. H. H8 w6 Bns_marquee.left=marqueewidth+8
+ B) f7 i' P9 Ons_marquee.document.write(marqueecontent)# b: _5 F, U" b3 _$ U
ns_marquee.document.close()4 C! o% L- n5 n% L4 a. n9 e
actualwidth=ns_marquee.document.width
0 m# m- |, m6 ^4 B- Q/ P6 t}
8 X! G% Y5 h; c! u* |# i8 [1 Plefttime=setInterval("scrollmarquee()",20)& d4 s2 |# e' `! c c
}& C. b$ c7 Y; i
window.onload=populate
' n$ U. E0 T- }) r* w+ T/ A1 I! u- F; I
function scrollmarquee(){
+ g5 Z" {9 @2 P0 Nif (iedom){- k4 v4 i$ B& m! ]. D# W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ W& n' o0 c/ _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ k; `; ^" x, Z2 X$ f- M
else. t. J" m* l5 e: X4 r# R
cross_marquee.style.left=marqueewidth+86 \" t+ g6 Z8 r. ^$ X. Y7 ^. H
" ? a1 k; t! _, ^4 r1 d
}1 |- h4 o0 K# s8 J! V% {& d
else if (document.layers){- K, H: o K* ?
if (ns_marquee.left>(actualwidth*(-1)+8))6 k1 _: E: a, @& `
ns_marquee.left-=copyspeed
: \9 | R( e' y4 r Yelse8 q3 I. ?* D& X; I) ~, Y& t3 B1 C( [
ns_marquee.left=marqueewidth+84 k m3 G8 i- M h. k( X
}
; s$ z4 M$ T5 k" r6 J! B& B}
V6 H* |5 f! ~0 ^/ D) }7 W3 U/ K* R' w6 z* B' A& w
if (iedom||document.layers){7 c6 b9 q4 J0 d7 y t* y
with (document){
& Y2 t( Y' E" C( B cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ Q& J- a( i" |2 W2 e3 W- Q/ r
if (iedom){
5 ~7 ]' n- s* mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 O2 M/ p* U6 J* ]) H2 K/ Y x5 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); J6 q% u/ I" a9 c3 H0 G8 K9 ~9 s7 W( F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( d# D6 r |" Q' W( xwrite('</div>')
# k, r! B2 ]6 t( A" X( ^% g6 g9 @}6 I" z9 G9 `3 ?" r
else if (document.layers){$ v1 P& k1 N, I* R9 A6 Q: u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" M1 Y5 u7 |1 m5 M. |- g$ Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 [5 y9 z7 P; Z* L8 |6 e3 z
write('</ilayer>')
# }1 w& q( m% N4 q# [, y; c O}0 y6 D# @+ U5 V9 l+ |; ~
document.write('</td></table>')
T/ B. Y* L7 a8 T: N; b7 O( W" V( \}
% M7 D- j8 O$ m1 U; f( w9 U}' J2 q4 O. M0 y
</script> |
|