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

|
网页之跑马灯文字特效
//修改宽度# Y7 |; z7 u( O% E! S+ w" h% a
var marqueewidth=3009 K' x. G1 R0 {7 \' u6 e& w
//高度
( n! A8 t9 I2 x+ mvar marqueeheight=25
2 L; ?, s0 F1 ?: K" W* p//速度(1-10)- J! ]* U* R: a- Y5 y2 `. e. Z
var marqueespeed=3
2 f7 k" B! T: H8 t//背景颜色
6 d+ W: `: }$ W& Hvar marqueebgcolor="#FFFFFF"( h( R% ^ N: o/ r/ r! e+ ^
//是否能暂停 (0=no. 1=yes)?
: _" U$ Y( J* v. C# Zvar pauseit=18 F; B5 J8 e" M; z' A' z
F: G8 K, \- F: y: e. f2 ^: M//修改显示内容
6 t! B, h! b& ^! Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 z% \4 X" X8 @0 X c; _
0 I z- n: Z j. V) i. m' f
/ D B4 |* X: W% T% I _////下面不需改变////////////) S2 B3 Z# N( c: ^
' T$ ]9 Q4 E5 l+ t+ s1 ~
var copyspeed=marqueespeed
1 G3 Y/ e) ^8 f3 J/ h, ~& {3 G Lvar pausespeed=(pauseit==0)? copyspeed: 0
4 u# E5 R5 W; Rvar iedom=document.all||document.getElementById# k. e2 d, ]% U
if (iedom)
/ s; Z! ~% l/ O( ^$ ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( _) |; Y6 k4 D+ g
var actualwidth=''% ]! p8 b R; t. q8 g- W* _. z
var cross_marquee, ns_marquee, I6 m# e& P: X8 p
/ t1 j' S! @" tfunction populate(){/ ~" r) _1 p. g7 O0 Q
if (iedom){
! L: S# y$ x* q0 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! K& g- O1 T' vcross_marquee.style.left=marqueewidth+88 |+ s( G3 I. T: m1 [/ l
cross_marquee.innerHTML=marqueecontent! S3 y8 H9 f. z/ n8 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 c! {) H$ I8 ^: `
}
: a7 _; S/ e7 y* k. B* belse if (document.layers){
" f' d) e* @) Gns_marquee=document.ns_marquee.document.ns_marquee2. \ X, u7 G( x/ r
ns_marquee.left=marqueewidth+8
/ v3 e" D' D1 q( z2 ?& Xns_marquee.document.write(marqueecontent)
3 T( E9 p9 d! A! c; F7 ]# dns_marquee.document.close()- {5 w! ?: l9 K: o
actualwidth=ns_marquee.document.width
X3 e8 E/ d" P+ N7 x% P# I}
7 h$ D+ o) J5 G5 `7 `+ Tlefttime=setInterval("scrollmarquee()",20)( T# m. k' Q9 n) ^4 L% N0 m+ i# L
}# ^- _/ b9 G O% T0 j9 u1 \$ d" W
window.onload=populate
" @# P, ^1 S6 E/ E) B5 e+ |
; G, y- m c/ {; j6 d! z. N Yfunction scrollmarquee(){( c) H* S. y7 g0 p; G% C8 ?
if (iedom){% M, c9 C% |8 Q0 N- p$ l4 v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), n. W% p; c, a+ y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& h t) Z; D0 I S3 _2 kelse
7 N- h( o+ L% c% k3 I/ dcross_marquee.style.left=marqueewidth+86 j$ G2 u; @$ x$ q
" ]0 T2 S4 p; Z4 [
}8 K! d5 b; X% ]1 r5 H
else if (document.layers){# ~1 Z. ~* g& k1 ~
if (ns_marquee.left>(actualwidth*(-1)+8))
& \* N. G' p: A; R0 h5 E% [) e9 Rns_marquee.left-=copyspeed
2 C" t* \4 a& [else, E9 ]+ R0 F6 G3 a( D! x, c
ns_marquee.left=marqueewidth+8; x0 ?7 y; r" I, p" M
}
: G2 N) U% ?% W- S3 B}, D, p& [' ]9 ?6 \5 `' F4 n
- Y% t6 O( n" e! l
if (iedom||document.layers){2 E7 n; w4 D. z1 e( ]
with (document){3 B/ i: s3 a/ ~* v9 b4 l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 J+ L/ Z1 V' n9 yif (iedom){
( s$ U- A" o4 R- xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): o3 W/ X% z4 i% @5 q! s' d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ F/ d% p6 M% r( b* @" @) e7 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
|6 G/ e1 ?: b% a# f: Nwrite('</div>')
/ h: @: S$ B$ X* _3 q' R+ ~}
: C8 \: E9 \8 N/ X/ ?" q$ @* qelse if (document.layers){
: ^( f* {/ n$ Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# O6 k1 e, h# M8 |1 l/ cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 X& J( ] [5 C1 q( ewrite('</ilayer>'), _5 h* G. ~- f. d
}
4 R, h3 e, i0 ^( Gdocument.write('</td></table>')& W; [+ n. [) L" i A
}. W$ E5 G K6 l# a
}8 i8 O1 v# O) f- f0 B% @
</script> |
|