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

|
网页之跑马灯文字特效
//修改宽度
; W' o1 Q+ K" c: ?, Uvar marqueewidth=3005 U6 ^' I" z( `, _0 ~% l
//高度
3 R( {1 ?6 M7 u" ^& n! p kvar marqueeheight=25
3 e8 E8 F" U( K: x w, Q//速度(1-10)
) X* ]# y& w @5 rvar marqueespeed=3+ G. o1 L: l8 N
//背景颜色
4 \( a' W- d; O1 T( A3 Rvar marqueebgcolor="#FFFFFF"/ {) w! ?- ]( r4 y1 o* C
//是否能暂停 (0=no. 1=yes)?: h+ N3 g5 [! X9 G, ?. F
var pauseit=1/ n+ C* x" r d# j; |( B+ s
+ }2 A2 C6 G/ ?
//修改显示内容6 W }$ V& G% v r& G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' q; U8 ~1 G; f. b- _1 {$ F/ Q* V" e$ K/ h% C a0 l- O+ r$ o
7 x2 P& _' x4 M* g5 K////下面不需改变////////////
" W0 q5 @( G/ W( C9 }/ e' ~" a ^ W1 y/ P
var copyspeed=marqueespeed
6 A3 b+ y8 e; Fvar pausespeed=(pauseit==0)? copyspeed: 0# U& a5 W% e; ]7 o) B
var iedom=document.all||document.getElementById
9 y; R+ c* @* M6 f* mif (iedom)
3 B, r, s1 A& g( ]9 b/ W0 vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( e0 L: y2 ?! c$ P, o. _/ N
var actualwidth=''- Y" G* S3 Y- t y6 ?
var cross_marquee, ns_marquee2 r! O$ ~& V/ |! A$ O! G3 z
3 B }& {4 J0 l3 i% C, |2 h$ j& J# b
function populate(){
0 C% ~/ y# S/ Y& cif (iedom){
( u7 h( V, m* o) q4 M+ ]6 s% kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 l4 W- ~9 Q. o8 f1 w* G
cross_marquee.style.left=marqueewidth+88 i+ \5 V# f; N5 A Y
cross_marquee.innerHTML=marqueecontent
* X5 o* G# w) ? J: W8 Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 z. S; O& \( i, g' B
}
# w2 f0 V, b e" _else if (document.layers){+ ^9 [- e" W% i: c/ m. ~
ns_marquee=document.ns_marquee.document.ns_marquee2
" v8 M9 M6 Q6 O: |ns_marquee.left=marqueewidth+8. h; W5 s6 L( w: j4 t9 x+ w3 H) @
ns_marquee.document.write(marqueecontent)
7 ^/ K. @( C! D$ u0 {ns_marquee.document.close()0 A+ J- S; ^6 o K& o8 c
actualwidth=ns_marquee.document.width
% n# S4 Z2 b- X! n}0 D4 R) W0 ]0 C5 m
lefttime=setInterval("scrollmarquee()",20)
! t p7 I. z2 I: O, w}
- ^- Y# H" j1 h5 uwindow.onload=populate
# w1 b; X$ K7 N- Y" O) z- @5 H6 T5 B4 Z% G* X+ c3 `
function scrollmarquee(){
( b% f: t$ ^% {7 z" @if (iedom){
- O+ x: J3 \% y' mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), Z$ }0 c$ U5 Z8 d+ G- w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, J0 [% B1 W! | t( B: f7 a! Melse
+ s3 Y5 y2 P' q' s, g5 Vcross_marquee.style.left=marqueewidth+87 T5 j$ ~' Q4 z n: L
" ^3 U2 O) M0 ~1 t) j}0 f* M& ]- h) b+ C# B1 l. W
else if (document.layers){
7 P/ s" j7 H7 {! ]4 x7 Kif (ns_marquee.left>(actualwidth*(-1)+8))
& z4 @* b* M0 v5 C Dns_marquee.left-=copyspeed# G. q/ d! X. N4 ^0 D3 A4 F. g' B# v, a
else& x/ b; C b F- y* a, ^+ |
ns_marquee.left=marqueewidth+81 x0 Y8 k: H* W
}
, I$ {; ?5 y1 k" t" z- o3 F# C& o}
" e& P; g; [/ m/ b: q9 Q3 x! P9 z# [0 y6 n
if (iedom||document.layers){! r+ s- r) u# y3 V9 d8 M
with (document){
! y# m1 j' h/ v% P( ^- ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( d) x1 P: {' K' S
if (iedom){
( e7 n$ o& v5 P+ W+ z1 ?# jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ h. t7 g1 z8 J5 A1 C( g d7 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% `! `, A$ m5 K4 p& _" C0 _( P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), u! ~2 }9 k8 N8 [+ r9 m
write('</div>')
' c3 z9 d% G9 C- q}
! r O2 s m" O, Gelse if (document.layers){# s' y1 L* I: @9 w0 J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). P1 ^7 G$ R; K6 D5 x: S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- |! X- \9 e* k; A; p' l8 t
write('</ilayer>')
1 k y) s* O( a* q h0 ~}( x" L+ G2 H- G/ w
document.write('</td></table>')
: k& K; Z* J, j" M}
& ~7 N/ Y: h4 p+ A7 L2 ]}
9 Y4 e" h5 A; O& |. O</script> |
|