返回列表 发帖

网页之跑马灯文字特效

//修改宽度. ]/ i- }# q5 g/ e
var marqueewidth=3000 u  E, r! H) X3 L1 w; D* c- c
//高度3 M1 d- {$ j. F6 t# G
var marqueeheight=25
" I0 T% h4 d& W0 A& k7 X( J//速度(1-10)% a  o' X1 K7 T$ x, Y9 R' p
var marqueespeed=32 d. p" K5 o: w, ?/ d
//背景颜色3 A/ @, G! _4 K; V2 J3 N. ]: ]& d
var marqueebgcolor="#FFFFFF"7 z3 ?* C4 t: S7 m+ S! U1 E7 d
//是否能暂停 (0=no. 1=yes)?. }0 l( l, y9 D* [1 H- O* p
var pauseit=1
3 }9 ~* ~1 o7 W$ |% i/ u& a' l' T7 w- e5 f& f/ E4 a
//修改显示内容
7 I. X/ A$ e/ o5 ?3 P% bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! F/ U9 f2 k5 T( e9 U* j8 U3 x! t# u* w2 @# _* s" c
' L6 \5 p" x; ^
////下面不需改变////////////
, ~- `- k  a; D: F/ }
. n% D9 C/ k" C' e8 svar copyspeed=marqueespeed
9 {; L" h$ x/ z  Zvar pausespeed=(pauseit==0)? copyspeed: 09 F8 Q% _, G: J& z. R+ R; P5 l
var iedom=document.all||document.getElementById
- h' q" R+ z* L7 e$ g+ Pif (iedom)
' f- R" H$ w* a) Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' }3 F4 @4 M* m! l) W. Z8 j
var actualwidth=''
8 \$ ]" H4 U1 f, s, S  Q* kvar cross_marquee, ns_marquee
  i$ o/ r) }& K$ p. ]/ y: U1 W. ?: o0 G( P" y
function populate(){
3 h, [7 r1 H. t5 Cif (iedom){! V3 @* ^1 o" F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. t# h- F. [% z  d( o) ]! v
cross_marquee.style.left=marqueewidth+80 U( P/ L+ L  S
cross_marquee.innerHTML=marqueecontent
  E8 y6 g% G, Z6 y: _- vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ q3 n/ m8 u+ j, }( K! U' u}
3 o! R/ Z0 x3 G0 [  telse if (document.layers){
. @. l+ ?1 x1 ]& x$ X$ e! D: G4 hns_marquee=document.ns_marquee.document.ns_marquee2
& J* E2 ]7 E+ B+ ~9 ans_marquee.left=marqueewidth+8. W- v+ G9 `: ^6 G& Y8 C( f# ]
ns_marquee.document.write(marqueecontent)% l# ^5 A* P! f4 z8 T6 y
ns_marquee.document.close()  x8 N  i- }- ?, q" E
actualwidth=ns_marquee.document.width
9 ^& a7 F; F, n7 c8 p9 [}- i4 [( w* Y$ O( p
lefttime=setInterval("scrollmarquee()",20)
  y7 [: M# p4 \# y$ F}
8 A% M8 K3 t( U' I9 q# Nwindow.onload=populate
. U; [8 U& M- E2 X2 a- ?4 _: `5 j
- x0 E  [8 y4 S% |function scrollmarquee(){6 r* H# X5 Y5 |. N" p; m
if (iedom){1 X: e* }! q" i) w& ?/ [6 {7 n) @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 }$ }+ J" z9 ~, \  i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. h9 I+ x" {0 j! I7 D: K
else1 y; O4 P$ i: K+ R
cross_marquee.style.left=marqueewidth+8
5 Z# i0 [$ I* D% t" n1 W- S2 I$ m& s; N/ c$ `+ p+ C
}5 r% m8 \' w8 x! h$ R/ i* y
else if (document.layers){
( b5 \- E' c/ |% _( a. N& c) v( Dif (ns_marquee.left>(actualwidth*(-1)+8))  h9 ~3 Z( Q1 L/ `& A2 A
ns_marquee.left-=copyspeed8 N, T0 h2 t- J$ V
else
" v2 s$ V5 W: x$ |' F: Bns_marquee.left=marqueewidth+8
/ o& J' j2 F2 g& _/ N}
5 ?$ }5 g+ H7 l. B# Q}6 }- r, A# u+ l1 ^: w% o" }
; ^) [$ o" {, V5 E; q& N
if (iedom||document.layers){' d& D8 K9 y5 K+ V- N! g5 w
with (document){8 y4 Q' {) E% @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ U( `7 f/ _; d! Hif (iedom){0 K# n5 @) e5 L2 t" Q' y1 D5 Q. g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: }" W  d1 N8 g: R  E3 R" Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" \$ Y3 y2 w$ x, @# w9 s  L1 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- J# D8 P0 T& k! S/ M0 i
write('</div>')
0 F+ z9 x+ A/ c- r3 n}' {2 R+ ^5 o. X6 D3 W
else if (document.layers){1 R) f: r& P2 u' z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& {7 r* X) A) `9 ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ I! m( J2 h8 n2 T0 pwrite('</ilayer>')4 w8 m4 p! n6 O0 ?$ k% r
}5 o$ g$ a% S+ Q# B* T
document.write('</td></table>')4 G8 w; p5 d- }% i0 d9 l3 M( _: g
}3 G4 [5 E7 K$ r, d2 e
}
, {2 J2 g5 _  S: x5 s8 G</script>

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