返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ e) @# K0 K& \7 H/ b( U
var marqueewidth=3001 x3 N1 l& U/ f( s
//高度; G9 w; r7 Y1 f* O
var marqueeheight=25
/ t6 ^7 t, J: b* a: A' O4 x, K//速度(1-10)
) y. J& o+ H- Ivar marqueespeed=3
- G& ]8 D6 x$ B/ Z! d3 g. y' X4 F//背景颜色
1 x& d4 h. Q  O5 t, ~var marqueebgcolor="#FFFFFF"% m6 |+ U: O6 P! y: K
//是否能暂停 (0=no. 1=yes)?
  g' |1 |1 \& nvar pauseit=18 `# ^0 y  W3 ], L/ x
$ y- Y; O1 Y4 |( O! n
//修改显示内容
0 H( z( p4 ?& s; e  }% M" |, s$ g" Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; e+ a( Z2 |* Z, g# A
$ p9 I' |! X* Y1 @  U! ?% R3 L8 b* F% ~7 C; L$ a& ?3 F
////下面不需改变////////////
5 G& v1 x! U% I* C* H
2 {9 P! O6 t* [2 mvar copyspeed=marqueespeed
( b% N" {6 ~; `4 c: \7 mvar pausespeed=(pauseit==0)? copyspeed: 0
0 ^. Q# _: g; P& x3 }: |var iedom=document.all||document.getElementById
3 ^" z3 r4 ^$ j& M3 ]5 J3 Iif (iedom)
7 T% s* g& i3 D, _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; K- T" J9 [& ~0 Bvar actualwidth=''
" d; D, z' L2 F0 ^4 evar cross_marquee, ns_marquee" X. B$ [- [+ {$ D5 U' v5 Z
% S( Q+ ~1 a6 T$ O) c1 [+ i
function populate(){
; j7 j1 P0 g- P$ Oif (iedom){
" x5 v5 y! a" C5 _2 M9 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, D+ u6 `) h- R" r/ B
cross_marquee.style.left=marqueewidth+85 f; ^3 X, e6 B4 v7 i
cross_marquee.innerHTML=marqueecontent' V, \+ X$ [: m( ~1 A) {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% r+ j1 p4 j# q1 x  K' I" t}+ T5 C4 H2 S9 r" q/ t+ s& K5 l
else if (document.layers){
1 k- }* F9 o* h' a* Tns_marquee=document.ns_marquee.document.ns_marquee2
1 H* r. m5 ^  M% [4 ~ns_marquee.left=marqueewidth+8; v0 e" @7 C+ L
ns_marquee.document.write(marqueecontent)( H& p& l0 z. y" f0 O" T
ns_marquee.document.close()9 U& M4 {6 c% }
actualwidth=ns_marquee.document.width/ w! {! |8 }$ e8 }) w
}
8 T0 q/ `9 A! J* ]lefttime=setInterval("scrollmarquee()",20)
' |2 v1 t" f& r) u}( ?7 |% Z9 {( Y/ Z' H
window.onload=populate
& Z; S) n  ?& r+ U/ @' d8 K, i$ _. X) h( G
function scrollmarquee(){
  F" [; q* Q( h) [# P8 Q. O5 sif (iedom){
- r0 Z9 v3 F6 k" e2 Y6 z+ Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 K  T) D- c6 ^. U3 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ |% |  g  E- V2 \
else
# a7 x* t$ `  @0 N/ ycross_marquee.style.left=marqueewidth+8. B1 Z0 Z6 w9 w: w' \9 [; i$ N
( e# e7 y2 J6 t8 e2 x" Y- P# F
}5 W( j$ p/ M4 s0 k8 M
else if (document.layers){6 d0 f6 y/ b8 }+ b# Z6 Q3 e
if (ns_marquee.left>(actualwidth*(-1)+8))& ~5 n# ]6 ], [# n( N; ?
ns_marquee.left-=copyspeed
. C( j1 H8 t' V* Y$ m) P; [else, N2 ^9 G5 ]# G& D- F7 x9 E/ \1 d! y
ns_marquee.left=marqueewidth+8
) R4 g, t! `7 U  A* s# p}: B- d6 H5 I. f$ X6 x& ~3 I
}
2 C4 l" s! _, d& i3 B* @# V1 i
4 G+ ]. A8 k! L- F9 J. Kif (iedom||document.layers){) u5 c2 M/ C% ^9 T+ d2 p
with (document){
7 M% B1 @! A: M; K0 t6 J+ K( Y9 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ q9 H$ {4 l- A4 B1 S" M# y# _if (iedom){3 u( h% \% v3 r# U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 y5 q9 N1 c; k0 }" o# p7 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% C" e- M/ C% U: o! L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% o8 M0 \6 _. h! a+ hwrite('</div>')9 L# v7 q3 }: O
}0 M, U9 p& N8 c
else if (document.layers){$ [! k& {' k  Q" R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 _4 }( s2 P( Y9 Z, P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 s# T) i  g; ?
write('</ilayer>')/ F; F' I, K) E( s% b9 [. u* m
}
7 T6 d) A9 n) ]! L, F  edocument.write('</td></table>')
7 a' W; a. p0 f% f}) y" I/ U8 U: T$ Y- U7 F1 P; p+ {
}3 v; b) A$ T! N0 v; l& F
</script>

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