返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ C& F5 ~6 k, ?0 Q8 X# V& C% Tvar marqueewidth=300
0 m5 C; @. M! b! D$ @5 \* P- ^//高度
+ E% M: k5 J+ c* @6 Dvar marqueeheight=25! u' Z: U5 h5 Z2 P
//速度(1-10)2 e6 f- K% W0 Q4 U! ?
var marqueespeed=3
3 s3 P1 j+ f5 N0 t//背景颜色$ h- C* o5 O/ L% t
var marqueebgcolor="#FFFFFF"1 M+ `8 x+ Z3 B$ Y' h( ~) K. k
//是否能暂停 (0=no. 1=yes)?  p3 d& F& u+ @8 B& F2 P
var pauseit=1+ A' T* l  k" F- R/ h3 [. J

  i8 m- M3 c% M# l$ n7 ]//修改显示内容
6 w- @8 M& I; ?6 Q; a% tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# X) y+ t, t' K5 Y+ |

3 z) L2 ?  e2 w! I: j9 q
3 y2 l6 p9 |/ X" E% Z* |. f////下面不需改变////////////
" |" F$ t3 I: u' \
. x$ T/ [3 f/ Q$ F& |var copyspeed=marqueespeed
- r$ k2 s5 w! w* N- ^, Z. |var pausespeed=(pauseit==0)? copyspeed: 0
! h/ n$ x" h  I) y. x+ o0 r9 j) mvar iedom=document.all||document.getElementById
1 i; U% B" z# l3 Q7 T9 xif (iedom)
! ^) A  m' S, M/ E7 L# \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' N, n$ E5 ]$ q! F4 L0 ]# q' l* y3 ovar actualwidth=''2 j. m9 b2 Z. b5 n" S6 w6 R
var cross_marquee, ns_marquee
4 t2 N, q6 `, c. N/ y: w& @0 w# p: c1 u- b0 o
function populate(){4 ~5 b. h7 O# Q
if (iedom){
5 d  [/ O* m2 Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 D- r* s9 [" W. ?  o6 ncross_marquee.style.left=marqueewidth+8
) q. S: g4 r) k2 O9 j3 P+ Ncross_marquee.innerHTML=marqueecontent
' C% B0 K. G+ x; d0 S5 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, l( ~5 z$ b! b8 R
}! Q1 N" D& l, t( W
else if (document.layers){7 w& x. W: T2 S( ?- w2 W! C2 O' V6 E7 Z
ns_marquee=document.ns_marquee.document.ns_marquee2
8 w. h1 d. M( i( p3 M5 Kns_marquee.left=marqueewidth+8; e% ~! y1 d8 g  [* X" H. a- b
ns_marquee.document.write(marqueecontent)
& X" r. `, J6 zns_marquee.document.close(). l" U/ r/ y7 h
actualwidth=ns_marquee.document.width
( `1 @# N, u( a; S}- O4 b  ]! M9 e
lefttime=setInterval("scrollmarquee()",20)5 G5 g0 ~/ d1 Y: K* X0 Z) q
}% f" Q! [+ r* _4 o! A, A, O6 L
window.onload=populate9 m/ q3 n! T* O) u  P
! Z$ A( O! d- k
function scrollmarquee(){
/ A4 A3 G" }, j: qif (iedom){6 y- h4 U! H& _4 I: R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ u0 |* ?$ Q' c2 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% @$ S/ F/ V3 k# X" W4 H$ pelse
+ c, s" x* \/ R# bcross_marquee.style.left=marqueewidth+8
/ u* |! ^' z/ b7 V+ F; G) d1 q/ `7 D* u6 H! v% S! B; R1 W
}( b# `: u/ X7 x! S
else if (document.layers){2 V& B9 P& V* Y
if (ns_marquee.left>(actualwidth*(-1)+8))
+ j4 _3 C% d" Z  C8 pns_marquee.left-=copyspeed6 y6 p% Q4 R' X3 X
else1 P" f  W9 m7 m* [; e  }
ns_marquee.left=marqueewidth+8
, ?1 p* o2 Z; F  }# D; q) }, {8 K}0 [& h% [4 f) m1 X9 F9 Q
}' F4 B7 J% H) X( e! t4 h

, T+ Z" }% a, }6 v' z; g+ y5 Cif (iedom||document.layers){
0 b2 F/ j0 n8 X! P9 K  _+ Awith (document){# I- S7 t* t: @1 Z) [- o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 i) Z$ h. j* I/ V0 i2 c8 Tif (iedom){
6 Y0 ~1 L% S! m. t5 i4 o# twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ i+ w# }7 [  }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ H' f: h1 \$ ]$ t& A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). F8 y, s% `5 G* x- |
write('</div>')
" s" f! @  o. B' Z: S! L% B" C}
2 ?* s' p( Y' x! R) l- Uelse if (document.layers){
8 A+ g5 @1 m% T* I1 T# {# |5 v+ Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% t( K7 E3 A, f3 H0 l2 C' T- Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 ]6 }: V; p# P3 E+ p" G. Bwrite('</ilayer>')% c8 O; E" y/ z7 F
}+ Y7 f0 i9 f  a' {$ N
document.write('</td></table>')
- U! k# v" c( x, a}3 u- m/ @8 I* C; \1 Q! Z
}
# V5 p3 ^- J% g</script>

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