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

|
网页之跑马灯文字特效
//修改宽度( ]$ Z+ t; o2 `9 Y) u
var marqueewidth=300
* d/ y& i b# D( u. B( a//高度
" A; M/ t6 z0 q/ L: i+ |- nvar marqueeheight=25' w& p. `* x; L
//速度(1-10)
0 v% D0 X. l& w7 S) q- v6 Fvar marqueespeed=31 W" H* m$ h1 V4 E
//背景颜色% R- ~. ]3 o: x$ ~# H6 ?
var marqueebgcolor="#FFFFFF". V) a9 v! p! ~# a
//是否能暂停 (0=no. 1=yes)?
- C0 x. d0 A1 m9 r& s6 bvar pauseit=1
. M0 B7 d: {1 W3 Z
" ~0 }9 U% F i, @9 \//修改显示内容) h! B; a) v1 o/ H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# E1 I! r+ Y a5 a
& X3 _1 J9 L ?" P
) d' e4 b) s8 x////下面不需改变////////////
9 W5 W( `8 B4 h5 q
0 o& [& N2 V. [3 }& Zvar copyspeed=marqueespeed
5 |8 _ {: P4 A2 [8 nvar pausespeed=(pauseit==0)? copyspeed: 0
! ]) X g/ S. l9 Q- z1 L" avar iedom=document.all||document.getElementById3 B' C0 g V# T j; |* S
if (iedom)
1 p' p* a5 [* f2 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. E s# f# I7 |7 D% F/ zvar actualwidth=''! f: Z/ T# L9 `2 n2 {& B
var cross_marquee, ns_marquee, n6 B0 S6 q' x7 K5 x% w
3 t: |8 u* x- _3 x! [1 bfunction populate(){9 o- ^0 ^" _% L
if (iedom){
4 ^- f3 R0 P4 O2 w7 @3 o# R8 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 |) S1 b2 ^/ |; P1 T# z0 g" t1 Ucross_marquee.style.left=marqueewidth+8
) R1 E# b( p. j) N, I6 Y0 b+ across_marquee.innerHTML=marqueecontent
6 L' k# z* L# Q. o$ Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 [9 S E. }6 J! a' r6 F1 I8 c9 o}* K) N( g. E, z2 l6 J! q- `
else if (document.layers){7 W5 m' Z6 r- s3 v# Z
ns_marquee=document.ns_marquee.document.ns_marquee29 x5 ]- D9 a: x
ns_marquee.left=marqueewidth+8! @) h9 c: e8 [
ns_marquee.document.write(marqueecontent)
& b' J2 R k4 R/ T. [% V7 Sns_marquee.document.close()9 `* \& k6 W7 H8 Z; ?( q
actualwidth=ns_marquee.document.width
0 L9 {, _! G+ j$ ]* h}
. w+ D9 k6 h+ T# Dlefttime=setInterval("scrollmarquee()",20)
4 b% J" k- H# J( i6 S}
( N& A8 C( V {! Y1 u0 Cwindow.onload=populate! X3 G7 K7 l- J! `# g- y
5 ^+ ~5 f7 B+ g7 M6 ^function scrollmarquee(){
' j6 ~: M$ J, G& ~# lif (iedom){
0 I1 m8 R V( t% f+ M/ Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! N; h; G5 N9 S5 k3 n: Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 k( n( y; q6 Y8 jelse
. B2 H4 d3 O$ Z# v3 w0 Vcross_marquee.style.left=marqueewidth+8
: H( y3 s& s1 P; A. @% `9 D/ {# e: _7 H
}
- \1 ~) v0 ?6 T+ F) Q( m! {& E" Nelse if (document.layers){
, G3 j$ M0 V2 X6 Sif (ns_marquee.left>(actualwidth*(-1)+8))
A4 ^5 n. T* \, M6 \ns_marquee.left-=copyspeed
$ f& {' k. ?1 p2 m% Y6 W- N) }else
; v1 q$ D ~+ N) t8 R) a) Wns_marquee.left=marqueewidth+8/ o) F: H9 m8 V8 f$ ^
}% L* a5 w' V/ x/ h* p3 s
}
9 \$ Q- D1 o' w3 r
/ a; G- G3 _9 j( dif (iedom||document.layers){
" x C5 P A1 h, W: U: Bwith (document){
6 a2 Q, \& `8 `- Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ ] S/ R' [- R) k% ]: ?3 Q& ^: Z
if (iedom){
, j# N7 Q8 J# o2 t8 B( Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 ~6 L4 {1 T4 ^' [. h. L4 i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; l, r1 R1 f* R2 \" g4 wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ Z$ L" y, ?% W9 A4 j* O
write('</div>')$ a$ E4 }# N K& P" A
}
1 f5 B, o3 j, _else if (document.layers){
4 F# u+ F/ E/ K8 T. m/ i4 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 J. \8 J6 Y4 P l& h4 g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. b/ w9 Y# i" K( [/ `$ bwrite('</ilayer>')
9 r8 u3 N! o/ T- U e- v1 U}" o6 z# x ?1 t, I
document.write('</td></table>'): x/ G" @; L2 L5 S5 ]* J/ t0 X
}
1 |9 j1 e. Q. n" b5 s" \! R/ F* b$ Y}
9 R7 P% l) V4 Z, i3 N/ Z</script> |
|