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

|
网页之跑马灯文字特效
//修改宽度: z: T% w/ ^0 T3 j% u- n
var marqueewidth=300- l2 w7 Y3 R! v6 f8 N
//高度# `" e2 @+ V9 \0 i% e9 z
var marqueeheight=25
& P4 X$ f7 X, B( a1 c( H$ f7 l//速度(1-10)
+ Q4 I7 Z* B! K0 m" F7 `3 M1 Svar marqueespeed=3
- }/ N3 a; q% R# O//背景颜色6 O% t! F& `9 Z; w2 i. d
var marqueebgcolor="#FFFFFF"
/ o2 K4 F$ b+ I( V! W//是否能暂停 (0=no. 1=yes)?
, i8 z6 c6 \7 @1 Evar pauseit=1& S6 v( |/ S1 `( J) Z+ S. R
9 P- M2 b2 D, f. M
//修改显示内容
% `1 C0 k3 l& D+ L2 [- K) Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ K4 w& K# j) Y/ H# |- a4 g5 A, O0 Z& z
~) v: T; l, [% z; Z0 ~////下面不需改变////////////) A- r) K/ K r6 t
0 N+ C1 u) u" F0 L9 p
var copyspeed=marqueespeed
* g- v0 h1 p8 n3 a xvar pausespeed=(pauseit==0)? copyspeed: 07 z* e# n# \7 t2 v, |3 }) o
var iedom=document.all||document.getElementById' {: N9 E: f/ a/ U8 ~; S
if (iedom)
* o+ S5 o l! F) z+ N6 X# T/ z4 d5 W) Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* a1 }) v5 t: z O( X# Uvar actualwidth=''
9 {8 v4 d# U) tvar cross_marquee, ns_marquee
5 [% L/ p& y0 M) L5 N& \
! H; ~; A8 O/ i- C9 dfunction populate(){, x. U2 U: u6 u, x T9 R6 D
if (iedom){+ p- l2 [% e0 D* y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ h4 X0 M5 E i; A+ ~cross_marquee.style.left=marqueewidth+8* C8 L: f4 N3 H5 e" u
cross_marquee.innerHTML=marqueecontent
' I$ u; X% p. o) X, Q [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 S2 J" z# J1 w* W8 w1 l
}% U5 W7 w' Z, y! w
else if (document.layers){0 n0 O- g1 N4 E0 d
ns_marquee=document.ns_marquee.document.ns_marquee2" h* W6 ~: K; s+ R. Q
ns_marquee.left=marqueewidth+8
+ `3 h: U. d3 J# D6 Kns_marquee.document.write(marqueecontent)$ c& X# x9 a& I/ |: k
ns_marquee.document.close()
2 r' C. q' b8 r# \; v! T. iactualwidth=ns_marquee.document.width! }( F2 T5 h2 ]% M- t
}% @, z* n8 G8 T; u) `
lefttime=setInterval("scrollmarquee()",20)
, ^6 Y! R+ \& ?8 ~}
" O1 z, d4 U2 J! e) iwindow.onload=populate7 y1 E, ^; V) e0 Q: V) l
5 q9 V) _% s5 h1 T: }) X+ S
function scrollmarquee(){
" D, }( [% y4 L+ G0 ^$ W Eif (iedom){
/ O- c8 o2 ~9 Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ ?0 e, R! s0 M. ]1 r; q# P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
_; ]! `1 ]3 b& ]5 k, Delse" e0 [% a4 P# T1 b& ^
cross_marquee.style.left=marqueewidth+8
' J6 J; h2 `! l" y& P8 E9 E7 _* z, L& i
}0 l. A R6 j# j2 }! y. T" {5 R
else if (document.layers){
" K+ {+ y! d- w5 \& M) G+ E6 Sif (ns_marquee.left>(actualwidth*(-1)+8))
! G. V3 B, L# V" f* @0 r, Hns_marquee.left-=copyspeed
) m. \; A7 g# ~$ e6 ~* V2 t( Selse
3 H6 ]! d# r. |& mns_marquee.left=marqueewidth+8
# D/ a$ e' {% x/ b, {. a}- f! f. @, }9 z( d0 [8 D
}. t* l4 n$ B5 A3 [2 Q
% x8 l* w9 h" M" N1 F
if (iedom||document.layers){
, L3 ]! b% a, k; k0 dwith (document){
" z! W3 K% H; @+ x4 D% c' Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 C' R/ e) f4 A" zif (iedom){
* q) J4 v: Q6 ?0 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! K5 j# I0 c0 N8 }7 d! ~$ owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: d5 ~5 g- ^2 H4 }5 A ^. v1 Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): v" Z2 |$ q: g3 C/ ?
write('</div>')
( H" n+ W5 [" C* W9 q2 N8 }}- {6 b* f1 d& a# q! D9 O( m
else if (document.layers){+ c. ~3 G- ] q9 Y$ C1 D5 ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 b1 l; t: w+ {. G8 h+ J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# k) s. \1 \8 [+ L! W
write('</ilayer>')
7 [: U" Z8 a4 L# y: A9 _/ g}
; d+ _9 A* l+ Q8 |! rdocument.write('</td></table>')/ f: T: P. t3 Q0 l3 w
}
) \/ Y: x, A+ r, O I}
( ~/ H2 W: l" D& j* l</script> |
|