返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 o3 S- D! [7 C! f
var marqueewidth=300- u6 h. F4 A+ `! J; j
//高度% K* K) H4 L- V
var marqueeheight=25) Q- v  {/ G& z6 H0 A) g
//速度(1-10)
6 Q7 J* w: o5 `% r' M2 fvar marqueespeed=36 L, Y( \" Z- C, G" N4 ?; t
//背景颜色9 e+ k7 f7 L/ L! i  ^% n) m
var marqueebgcolor="#FFFFFF"7 j# b( H! x/ J7 }, E
//是否能暂停 (0=no. 1=yes)?
" _8 w$ Y+ X2 D( d- Q. x4 {var pauseit=19 T4 N0 l2 S0 z4 W/ K  ]
- K6 t# w9 ^$ x; _$ }
//修改显示内容
: v' C; e/ \5 t) f; }+ s  hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 j+ N# _6 A5 J" _
9 w. r. c- o: e9 v9 N7 Q
7 Y( Z, a: t/ X( b9 {; [$ I! w////下面不需改变////////////8 ^" \- }, K) r- c3 ^( p* e% i5 |

* k; x  u6 d( L6 p1 g7 Hvar copyspeed=marqueespeed  n+ y3 A* R5 o4 R: I5 d/ s% L
var pausespeed=(pauseit==0)? copyspeed: 0  _% E* ]" p5 l4 C- e
var iedom=document.all||document.getElementById! p4 e& T) U, T9 O- @6 `; B
if (iedom)& I8 z1 Q- {* B- h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 M  A0 f" V  |0 M: _3 R" j( h# s6 q
var actualwidth=''
8 [' g+ d! o- t% J, Rvar cross_marquee, ns_marquee
$ s+ k% ?- t2 ~* E. u3 M
7 k8 x& @5 u# L' Q* i0 lfunction populate(){* {1 I/ Z& C* Y) n, e* u, E
if (iedom){
2 A) k' C, R/ B% n! Z, }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; h+ k' K8 h* ~, [, I4 ^
cross_marquee.style.left=marqueewidth+8
+ y1 D3 J) ~4 I- i8 _- fcross_marquee.innerHTML=marqueecontent; Q! }2 d# [  B( u" {8 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% x, P! ?5 s' [9 u; ?}
6 T3 d0 a3 B; `! l( Belse if (document.layers){* a% ?% z: z0 w3 L2 t7 _
ns_marquee=document.ns_marquee.document.ns_marquee2
" d& d$ p+ g, w) N  g: P/ Mns_marquee.left=marqueewidth+8
& Y' A. U, w2 b* l( tns_marquee.document.write(marqueecontent)
0 T. k/ h6 w; N6 I" M, r1 Gns_marquee.document.close()! `( s) v* T8 ~! \* l) P6 T4 r
actualwidth=ns_marquee.document.width4 t/ ?/ w2 r( i* p6 r: k, t9 e
}
; B# Y# ^4 n6 F; [! I! `- c) vlefttime=setInterval("scrollmarquee()",20)
& f8 d1 ^+ [+ p( P: T" b! A8 @# d}' I# U& {3 U* `% P6 W) q
window.onload=populate- F, G& v2 ^! ~( r  r; Q4 n$ z; Z
1 X# `& ?6 S9 S) Q9 u# u
function scrollmarquee(){6 u: v( b% F# g- m/ K. R
if (iedom){
$ E! a1 v1 @( ^1 _4 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- j) W' o* j1 j* c9 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% {) N1 [" N( ^& x8 b* A* qelse
% _* N; j+ _0 Q0 Ycross_marquee.style.left=marqueewidth+86 q% X" O) J+ Y8 F* i( a2 M+ B# R

6 D4 ]& g# \7 Y. N}
+ I1 F$ f9 Q' \. @4 J; Eelse if (document.layers){9 [: n9 w# `' I* H
if (ns_marquee.left>(actualwidth*(-1)+8))
, L8 |  A: B- p3 s' G! L- f! vns_marquee.left-=copyspeed: e+ Z4 q: o) w+ |% M/ }6 D( A. P
else
4 }: ^/ F, h6 l) Cns_marquee.left=marqueewidth+8
5 O! w) Q! K/ D% K8 w$ s  \, a}
, ?( z, ^! I5 l( q}, U3 x5 d! K7 f! N$ v& q

# x/ a8 s! G: ]4 K! J& v$ d3 a/ L; ^if (iedom||document.layers){
4 \1 Z4 C) v6 ?! t* Iwith (document){
# f! a. F3 Y7 Q' k8 D6 N: Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ L" E" L/ ]. j/ h
if (iedom){$ _3 i3 v' U3 y/ g% h4 r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 B3 }9 L5 P4 m4 O- x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- V( w2 d. [' h9 P/ L; Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, }  c. f' h  _4 g+ ]2 W6 D/ U, l% rwrite('</div>')
3 z8 t3 T* L# [' A8 v! |}1 W0 e  z' P9 D* m/ j& C+ [3 {+ J
else if (document.layers){% r6 U/ q& ~" o  p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 L/ [5 ?  `3 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 I0 ~! n& \9 X  B6 }% Y
write('</ilayer>')
" V5 F: S3 k0 |, Z+ i  Y}7 R  ?" R1 [& w
document.write('</td></table>'), M! P& H) [9 ?* b9 t$ }
}
4 A& _! N4 n$ O. ?}
; \2 p! b- Y+ p& n" i( }6 G2 ?</script>

返回列表
【捌玖网络】已经运行: