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

|
网页之跑马灯文字特效
//修改宽度
' V4 w; c/ i4 H2 tvar marqueewidth=300
2 P4 T6 d+ t, ]% f& Q//高度
: y( }' k# V; ~: H9 a: F" Nvar marqueeheight=25
1 u; E" D1 N- v//速度(1-10)4 ~# L5 F, X0 o' P9 s" f" c$ k
var marqueespeed=3
" x% x& @: X% l+ d//背景颜色
1 H& y# e V7 W9 S( Gvar marqueebgcolor="#FFFFFF"
: D7 v7 [% q( _; N//是否能暂停 (0=no. 1=yes)?
) a- |9 {7 r" a4 d- q) evar pauseit=1
a( p* g& E1 O, f1 Z
! C! h7 |& N) |4 [//修改显示内容' r/ n; o! I" S; C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; h) q1 T7 i! v4 h! Q# q: q2 H3 b# i
9 J& A( a, c* p) o/ m, [2 Z! q4 _& D8 u) v6 t: A" ]
////下面不需改变////////////7 Q* @1 F6 s( e( z+ R- m! E" V
( d( i5 y( _) R+ M. `; G( c: Q
var copyspeed=marqueespeed
- Z3 `! Z% v5 bvar pausespeed=(pauseit==0)? copyspeed: 0
- A: h6 H X; z7 `" d. e+ f+ gvar iedom=document.all||document.getElementById
0 G% I+ b" N# e! b; S6 m* fif (iedom)
: w( F3 Y& B" tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ }/ ~9 f: _) i L8 `9 ~var actualwidth=''
" [( Q& N& j' [) mvar cross_marquee, ns_marquee
8 k. T7 @; D0 A6 W) a; ]9 X( E3 ?* c8 t
function populate(){6 y c; Y9 \, c; L) l4 H; p
if (iedom){
# ~7 u/ L: J! mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 _( o% Y8 N' V$ ccross_marquee.style.left=marqueewidth+84 a. A k' } n; d; U. N5 N
cross_marquee.innerHTML=marqueecontent
' u! h) m* E |$ k7 A8 @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. @1 O; u) w! q5 H+ q3 z& Q1 x" I
}
5 Q8 E! G4 u. f. f( velse if (document.layers){
! r% f ?' k: Jns_marquee=document.ns_marquee.document.ns_marquee29 ]' l4 p- q4 M9 a \
ns_marquee.left=marqueewidth+8
( D0 f8 B6 o3 _! \1 g4 ons_marquee.document.write(marqueecontent)+ h! J# G( f' v5 W: p" \
ns_marquee.document.close()2 O8 E' F* ^ z. Q6 K; ?# F2 w: [
actualwidth=ns_marquee.document.width! }# X3 Q0 _2 i% m
}
9 }6 X6 o$ Q. s/ U. M$ ]lefttime=setInterval("scrollmarquee()",20)
6 m/ }! f+ ?6 _) [ R3 o}
& o) o# F: z5 ^% `4 fwindow.onload=populate
$ d5 a6 E) t( |! C$ m4 e2 @
1 ~0 L6 G, c) }% |" cfunction scrollmarquee(){
! s9 s( H" \( d. e6 Z4 \' Bif (iedom){% F- [7 M1 @( M8 E1 c* e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) f4 O1 K* b) E5 i! t9 [7 Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ H8 K9 m3 Y3 K% |* N0 M1 Celse
6 C/ p! E/ V; G9 N* {2 V' bcross_marquee.style.left=marqueewidth+8- T8 Q7 q4 j' b- r# B
- W& T( U# V) ~1 S4 E% G
}4 o6 v9 A8 ~! q! w3 y* @7 I% y: a
else if (document.layers){1 N; N& O$ ?# N4 n4 T
if (ns_marquee.left>(actualwidth*(-1)+8))
" P* p- `3 z2 T3 H; q' zns_marquee.left-=copyspeed5 f! s6 T8 z' R9 Z, x) n4 U2 e! i' z
else1 R( w; M j! f5 x7 s9 D
ns_marquee.left=marqueewidth+8' r7 h: n$ D. V# n7 o
}
; i* A: p T; ]* e: ^9 E}8 e$ l* `) ~7 @; t
- H: U9 z7 d5 a9 f
if (iedom||document.layers){
/ L- Q6 w+ R8 W: j# qwith (document){% D. T& m5 w. z0 N/ ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( Z: s9 d2 Z4 T) dif (iedom){( v! P' `" o9 t; }# p' x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') O0 U% G1 B; g- x+ X+ t9 T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 Y! v3 n* ^4 R' N6 A; x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ L; z+ U2 [$ C2 _) ]write('</div>')( l, I0 J6 Y; N7 V* i- O
}) X1 u# Z9 B) L A4 w# g
else if (document.layers){
0 f9 H! A6 }4 z' Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 w# S* \2 r/ i6 @# v' ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' w$ v, N9 C- S' G* M# j" h5 F
write('</ilayer>')/ r% ^! z6 T3 J8 `8 Y- I
}. O( x3 p7 l1 K& a& p8 X' I5 W5 c
document.write('</td></table>')/ s8 H M+ ^9 ^* O0 ~6 h( ^* ]
}
$ M6 [ Y% I2 g8 j& l}
, m( r; E7 Z1 F/ e</script> |
|