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

|
网页之跑马灯文字特效
//修改宽度
5 v5 Q. H% v% n) r8 X8 F# e; S% ~var marqueewidth=300( H' z# g' q/ S: R2 ~4 o6 j+ j
//高度
; g. ^; |* v Y( t+ K- v, evar marqueeheight=25, O7 b$ M& {5 l3 k- M
//速度(1-10); b* U, i5 J$ r4 C' j
var marqueespeed=3! k) e+ `1 J P$ @: h1 c6 h4 {
//背景颜色
, E: c- y0 y4 W6 S! Cvar marqueebgcolor="#FFFFFF"( K1 t; z8 C2 @
//是否能暂停 (0=no. 1=yes)?. i! d9 B0 @+ [# b
var pauseit=1+ } T( V% i5 N H" r0 C y
7 F: w+ i$ r3 L+ ]1 |4 R% e//修改显示内容
, i+ `, l E6 C. n& x! dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 U- z- w! T) i3 q. O2 s7 {
r7 m. M! E6 ~: K$ \* ?" [0 b( X: }/ n5 @! v
////下面不需改变////////////) x3 V3 Q0 @5 ?; k
) ?6 s$ Q `3 S& a. J. R7 ~var copyspeed=marqueespeed
3 q1 D. a0 @4 q( u$ @var pausespeed=(pauseit==0)? copyspeed: 08 K, V" m% ?" D# @/ X& i
var iedom=document.all||document.getElementById
; a" ]8 O4 N, u- m1 P0 ]+ Tif (iedom)' D: b+ L8 ^% J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# G5 d: [/ E0 [var actualwidth=''4 A# m8 Q5 P0 \: V( h1 q
var cross_marquee, ns_marquee6 B1 L/ t0 p0 v7 b. d% |
, `7 _. o$ D* I, I1 A( F2 C2 h( ^
function populate(){
9 D6 E7 r, Y8 bif (iedom){3 N( H! P8 u2 t" W3 w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 O5 K! W# r- F+ O. q3 D$ fcross_marquee.style.left=marqueewidth+8
2 k& x6 \" j2 tcross_marquee.innerHTML=marqueecontent. Q5 p" c7 ?$ H k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 H; x6 |- K& s& i8 U C9 F9 I( y7 i C
}
- w: \1 l6 t; @, N/ Uelse if (document.layers){& J1 t$ ^+ a, f4 r% e
ns_marquee=document.ns_marquee.document.ns_marquee2
, t0 y; ` y/ O+ d$ W$ w: Qns_marquee.left=marqueewidth+8
4 a4 b2 B E" o" w) W& Dns_marquee.document.write(marqueecontent) z6 Q% T9 r' X9 s5 v1 f# m+ x. v
ns_marquee.document.close()
: g, |+ _. n; g3 O2 v" f. @% ?4 Eactualwidth=ns_marquee.document.width, b1 y: i* E4 D
}
* {' Y! U/ ~- Q: @* plefttime=setInterval("scrollmarquee()",20)
: S6 C6 U# B- P7 C% T* ^}
- \; M& k& h5 `* H, qwindow.onload=populate5 Q# x) j) T9 T1 m! J4 H9 c0 Z3 V
1 c" T9 j0 `3 D5 @. K
function scrollmarquee(){% Q9 @& p0 l* x. e
if (iedom){9 r6 j f" `1 T2 h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* W$ ?0 ?' @# q8 O3 @: m# X4 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
t3 f- \9 u6 jelse
- v: k4 a3 c9 I& W4 Dcross_marquee.style.left=marqueewidth+8
6 j! n7 t! w6 q( T: q8 f; [9 {$ D" f8 z
}
! H) N7 H6 l, ?else if (document.layers){- B/ c) n: r$ i) q9 h; @
if (ns_marquee.left>(actualwidth*(-1)+8))) _+ z& h; A% ~8 P
ns_marquee.left-=copyspeed4 d F, q. J1 w1 \9 H
else
; C+ O: }3 h3 d# }ns_marquee.left=marqueewidth+8+ |3 u9 s v3 d* r
}/ s; c" w3 W, i( j
}
+ f$ T# G3 K+ J+ q$ q5 T; l* B/ ^( U4 X; G, F
if (iedom||document.layers){6 l- D, x% c: z% s. c: m8 L
with (document){
2 ?( G6 @' w' O5 d/ J( ~6 f6 Z5 [6 edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 j9 z$ d( ~- ]- o' Jif (iedom){( `4 S% h) y6 j3 _4 D: |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- |" j9 J! j8 O( B# k q4 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 s R: q4 G5 H& ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 k( r- G3 ]0 f
write('</div>')% a7 L& N( ^. Y2 J6 ^
}/ v7 }$ z! H9 N! v: b
else if (document.layers){
: r1 T5 s, K Q: b4 ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! Z( S7 x8 T9 p3 g* X' ~7 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 j3 p4 r7 ~- G3 `3 X1 Y; lwrite('</ilayer>')! S1 V9 W8 P B0 S6 A8 B& @9 x
}8 v& L$ H( P8 z
document.write('</td></table>')! K( p- M, x/ q; n
}' U$ M6 K* R% g, f
}( U4 u; U& Y& H5 ?) O
</script> |
|