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

|
网页之跑马灯文字特效
//修改宽度4 {. n$ b [" N) v
var marqueewidth=300/ K ]$ A3 o- J" D6 z8 z
//高度
) F2 J: t: {2 q h9 z" ?- ]/ O% svar marqueeheight=25 V3 b. `" k2 G+ t b- m
//速度(1-10)7 N" m! x- \6 B, V9 _
var marqueespeed=3
6 f4 _) a' u7 N, a: W' |//背景颜色$ f0 l; W5 _, c( m2 b4 E1 g9 O( q
var marqueebgcolor="#FFFFFF"
, M/ n p5 m3 e$ ^//是否能暂停 (0=no. 1=yes)?1 u0 B, ]0 `* e, y5 l4 L
var pauseit=1
) }& Z0 F. q3 B7 O& D
" }3 R" L% v$ g# [, a3 _//修改显示内容
+ X1 ^: {6 Z8 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
\) S }1 E2 Q
4 N! E D7 m8 R& e3 |6 g, ?% y* g7 ?# d% `( n, {
////下面不需改变////////////, c7 b1 ?: s( k6 B2 [. T* C
8 _# d& {7 |; L9 Tvar copyspeed=marqueespeed
) L( I. G. H3 Dvar pausespeed=(pauseit==0)? copyspeed: 0' {, C& O4 i! g3 L* Q# w# N5 B
var iedom=document.all||document.getElementById1 M0 K+ C+ c' }' u9 Q: }
if (iedom): k L# x7 L9 Y2 P8 q, i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ `6 ~7 ?; i0 S7 A1 g. p" h% c4 c
var actualwidth=''
) x- j6 Q: H$ W$ H: u/ Dvar cross_marquee, ns_marquee9 i7 J y* B1 |9 C- J
- S: u! ~; R$ R- A' H6 W% ]% w. q
function populate(){; d4 M t$ p' |) o
if (iedom){& c$ F6 K6 |8 y1 O2 J+ o! r7 w. ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
S9 p4 S2 C) o2 F, I% Across_marquee.style.left=marqueewidth+85 r8 N9 \: ^, p9 s
cross_marquee.innerHTML=marqueecontent' z* ?, r' q+ v# y- Q0 ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 \# w! N7 r7 o; q. @: o
} V0 {4 {, l' e
else if (document.layers){% @( B% i$ b- v
ns_marquee=document.ns_marquee.document.ns_marquee2
# A5 w! p" J) s5 {ns_marquee.left=marqueewidth+8- Z& D, p& i2 x, @4 r* B0 h/ a
ns_marquee.document.write(marqueecontent)* @6 j1 H/ ]0 L
ns_marquee.document.close()
9 o$ e" n+ B, _" g2 @actualwidth=ns_marquee.document.width
0 e- Z+ f2 x2 }( I/ s; S2 _}; e8 {" h$ ^, U* K& D4 [( D* C
lefttime=setInterval("scrollmarquee()",20)* N7 v; ]( R# j( z: e+ Q' d6 L
}
4 ~3 J& ?. n) m( r( cwindow.onload=populate: W' I4 O% \. u% n! c" [
- ?; K# N- @6 w! lfunction scrollmarquee(){; w* @; L5 w. F& n( z
if (iedom){; M3 @4 k- }% I$ u$ k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ C' T6 w# V. t" U5 ^" icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 `; Q7 @) U: J. P
else
/ [5 L2 V( Y8 Y* h$ O2 Ccross_marquee.style.left=marqueewidth+8& o4 G4 a! Y K
' V7 @* B8 @% ~
}+ }5 n9 m: H) Q( L& Z6 a" ]+ }
else if (document.layers){0 u- }# e5 G" a; T( l, W
if (ns_marquee.left>(actualwidth*(-1)+8))
. A4 T+ @2 \# T( K+ q1 @ns_marquee.left-=copyspeed
$ j- b7 f9 u% _1 F2 d" E/ G) B& T$ @else1 ^! H; M- N$ ?2 T( }
ns_marquee.left=marqueewidth+82 B! S( @! A0 S
}5 n! R; i7 g7 F+ \
}
5 J0 s* y% k. E8 G. h2 Q
5 T ]/ u# t! wif (iedom||document.layers){
) w& Q( P/ V; v# I# e7 c0 Y" [with (document){. H9 C7 M: T) H+ {1 `8 I+ }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& l: n: x: F% l8 s$ d& }' Y tif (iedom){1 U9 p9 V3 h6 }. U/ r4 L9 g; s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 |/ w2 e- G ]# @* X( Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, l6 A7 E; Q8 P9 u6 \5 ?8 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 [' C& t2 b. E, U9 |" p6 y. K" P- `write('</div>')
4 W7 P5 [; S+ j' J. }( i1 I; F}
' ]; ?; `' _& ~/ s; _0 velse if (document.layers){
& H3 p+ V9 D, k% x% rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ m7 P5 k, P2 v5 Q3 N8 w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ i& t% t) F; ~, E
write('</ilayer>')
, Q+ s0 q% y( r# F}7 I$ C# T' i5 s) b( ~
document.write('</td></table>')0 Q/ j8 | ^ ]9 ~# V. D9 c7 G5 D' a
}
4 q1 o5 d2 a, U- _ s}
/ [" Z, Y/ ?$ B1 V; d$ K</script> |
|