返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ v# n3 N6 s6 u+ v
var marqueewidth=300+ y& E+ L0 \" j7 f; ]' A3 q
//高度
4 ]: y+ c+ e2 ?/ B4 g9 svar marqueeheight=25+ v! o* H3 F' o- L) k' f
//速度(1-10)
- W6 s1 \5 M1 D, Fvar marqueespeed=3
7 f1 I8 j- N) l" e% ]//背景颜色
* a2 }5 F6 l# s  Yvar marqueebgcolor="#FFFFFF", a" m+ M% y9 X0 j$ E
//是否能暂停 (0=no. 1=yes)?6 U! ^/ b& u- ^# ~+ n
var pauseit=1) E# R) m/ x: k% J
8 _9 i$ `  T6 ?/ S7 n  T: v- U- F
//修改显示内容
% q9 \0 T" U+ d) ^: lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 @2 P, [! }( ~1 Z7 j- f( G+ K8 q3 t" b: R; F( a6 g
# M! d- Y. ?7 p( n6 g0 h
////下面不需改变////////////
, t4 t0 o8 C* {3 `1 d
" w$ W6 _0 X( g1 p$ Vvar copyspeed=marqueespeed
1 o0 W  s& y7 [6 Yvar pausespeed=(pauseit==0)? copyspeed: 0
. B9 S2 \- n8 H7 hvar iedom=document.all||document.getElementById3 a" ]' I9 a, @# W
if (iedom)
9 c% I+ N+ J: F$ ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& g( I$ Q4 x, |3 R  F
var actualwidth=''
- R; w& c7 I: i/ g5 Z5 g! z* e3 jvar cross_marquee, ns_marquee
/ h$ }! y: I" J* }# C- l8 Q; H$ J7 p5 q* H
function populate(){" t& [. t6 G% d7 m" p" I1 T  g, `
if (iedom){: p1 P% h/ x$ h8 d8 u/ K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 z, K0 f& m2 }  q5 Ycross_marquee.style.left=marqueewidth+88 J; L* d( n# z8 T& t1 }4 v' ?5 o# i* F( I
cross_marquee.innerHTML=marqueecontent; V5 q+ [+ ]# x+ w+ y. @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ l5 C" ?% [( E
}
: T/ O: s0 b& r, A1 v1 d. helse if (document.layers){7 i& `  G  d' V/ D/ L3 ]! u& O' A
ns_marquee=document.ns_marquee.document.ns_marquee24 f. h1 Q" ^9 U7 W0 @& R
ns_marquee.left=marqueewidth+8( {2 X0 O: o( w6 k( ~2 N. @
ns_marquee.document.write(marqueecontent)7 ?0 Q1 \8 l& V7 I( g, N' K
ns_marquee.document.close()4 ?# _7 U3 [4 u" N/ G' n+ A
actualwidth=ns_marquee.document.width
7 Q( N* u3 L* B( ^/ d( L" K}
: y7 f' x5 H" ?0 O6 i( D, o0 d" I8 llefttime=setInterval("scrollmarquee()",20)7 ]7 A4 @. p3 M7 J& F# u8 k4 m
}) E% l2 h  f5 e
window.onload=populate
7 I# s6 ?; F) a1 {! B
) J, h* B- `6 @3 Ofunction scrollmarquee(){- X1 G7 r% h3 y' _, G) ~7 N
if (iedom){
1 e" Z4 I. t! B7 K3 U; F% l5 i0 cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), [; f/ D4 ?& P: a2 e9 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ a& E) `$ p5 ^1 a( d1 j! \! V; ^
else4 c5 C0 a/ u3 `" Y- y- T' ^7 L
cross_marquee.style.left=marqueewidth+8
6 q" ]. k6 a$ c+ i) ^! U
( \! P4 O7 ~7 q}
% F! M( Y4 n& welse if (document.layers){# z9 Q+ v) a" [2 C, F; H
if (ns_marquee.left>(actualwidth*(-1)+8))
% ]$ Q- F2 }& t5 J9 d0 _ns_marquee.left-=copyspeed
& V: l2 H! u9 belse4 J2 J& ~- b/ m4 V. O+ L4 ~( w
ns_marquee.left=marqueewidth+8
1 @+ {0 ?# \0 Z}6 \* Q- b: d* q. |1 {8 o  |  Q
}
4 `' w5 Y$ ]8 t0 W! U: q' G* b, b% |% r" n# l
if (iedom||document.layers){
3 F+ F0 G9 x+ e- b+ l: n& owith (document){
: w1 `/ Y9 j# v; O2 k5 Z2 ^4 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- g+ I; V1 D" c" E- e4 eif (iedom){
, o, Z: |) x) g: k( q5 H! Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 N; e9 A5 f$ @# qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: k# t; \# w9 n3 _- A: r/ Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 l3 S  I- T! K" B
write('</div>')3 d7 Q# S6 A5 B+ Y, U
}
/ u7 F( b6 K4 N/ x) S% {' kelse if (document.layers){
% f/ {4 Q6 w/ p# P5 Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 o' A0 ~4 Q3 S. s4 S1 `2 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" V" a0 J  k' Z' k' H4 Awrite('</ilayer>')
  g5 s" [& `5 s/ Y1 t( ^}
* ^  ]( U& {: w* Z# m4 Rdocument.write('</td></table>')
  _. z% E6 K) H. \2 D, }1 Q8 C}# q2 h; g3 \& h% c5 O
}& ~$ P. o9 w" x
</script>

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