返回列表 发帖

网页之跑马灯文字特效

//修改宽度* J* w& d5 |7 W6 P+ |$ @6 H- E" i
var marqueewidth=300
/ M* b! S7 i7 K+ }//高度
5 b% g1 ^, Y6 M8 X& C. N4 Vvar marqueeheight=25
3 V0 W9 d( l  K9 ^/ J  k9 b//速度(1-10)
3 c% e8 h9 N: ?# Z2 n/ [7 q' |var marqueespeed=37 R4 c  \- d* |2 e
//背景颜色* S6 q5 u3 ~5 g- U- Q) L- F
var marqueebgcolor="#FFFFFF"
3 v) N  z% u& v- B* G+ f0 N$ S//是否能暂停 (0=no. 1=yes)?& Z5 n6 a  w4 R1 I# N% T, g
var pauseit=1# Q% ?! F0 `4 Y" v4 H) u
  k/ A+ ]7 r' o" K0 U, u2 O9 Y
//修改显示内容  i/ K: [& B* X, P* P2 _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- x1 C" R( i( ^, F9 S- w
, [0 ^4 x( k5 o7 y9 ?" o* v: B) \
////下面不需改变////////////
3 a) w$ I8 ?$ M8 G& K3 U% x3 L, ~. a2 D0 W. f
var copyspeed=marqueespeed
# V, l/ v6 K( b+ W+ n( L( rvar pausespeed=(pauseit==0)? copyspeed: 0
2 F/ H$ O8 D2 {- O( r8 Tvar iedom=document.all||document.getElementById
: K2 S- v6 ]! u/ z; f; ~. K. o3 h" j, Oif (iedom)
0 g! Z& Z" C3 q7 }+ T; |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' e. \9 s9 v4 y& I" V) G0 y2 P; w) a6 W
var actualwidth=''
) ~5 I2 ^% m( O# bvar cross_marquee, ns_marquee
" ]& u/ ]8 [( r
1 u6 V4 k  A; I4 l  E2 R0 Y$ j! W! i3 ?function populate(){2 U" ^- }( \. u. `# n0 P2 d' Y4 a
if (iedom){
) F: I6 C$ d0 K, m# b" dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% ]% O  _" w9 H/ D) |) \
cross_marquee.style.left=marqueewidth+8
, L* x2 F, C$ t: Xcross_marquee.innerHTML=marqueecontent
( @/ ^' W) U9 m9 A: M3 F6 s2 A- factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" z9 B9 }$ W& S# }}
4 D1 w. B  T9 f1 B+ a8 Welse if (document.layers){# V0 g" ]) k! h9 Y* @
ns_marquee=document.ns_marquee.document.ns_marquee2
% J; z/ O! _; @& q: s+ @" \ns_marquee.left=marqueewidth+8
. Z- l' O+ J3 ^7 V! F: r0 I' ans_marquee.document.write(marqueecontent)6 i) M/ ]0 B$ N5 Q& M- B0 S( ]
ns_marquee.document.close()
: B" x% `$ s" t4 s, z+ Cactualwidth=ns_marquee.document.width0 z' y5 T) X7 V: R
}/ b1 K# c4 s3 Y8 D8 v
lefttime=setInterval("scrollmarquee()",20)
2 j- W0 v8 U' v6 W& _( p7 R+ K}5 j3 ^, I5 D0 s; \* G
window.onload=populate
" ]! c3 p4 l3 h  `5 v
+ q! e" @, E9 [+ f. Q, G& O) Gfunction scrollmarquee(){
, p; F4 @- Z4 _* N( V  I: Vif (iedom){) l% B8 n+ P8 h& m# P2 r, f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ C* Z& R% f* g" |. i) Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 H" D- N  M) F, [
else
1 N5 q3 S! q  Jcross_marquee.style.left=marqueewidth+8
, W1 x1 P9 u8 o7 e) I% `+ x2 W
  J- d* N. Y5 d1 O* j7 G( y, S0 g}
8 h; ?! R- V+ W& a% q% |5 u( felse if (document.layers){
' t/ @/ u4 z1 r+ {0 _, a- G$ f9 Uif (ns_marquee.left>(actualwidth*(-1)+8))" B" f) s- B) s9 o: D, q" g  I
ns_marquee.left-=copyspeed
- X2 j/ |* o+ P. Q, t1 ^, Melse
! V% r: B8 j6 }$ fns_marquee.left=marqueewidth+8
+ M1 N" [' T4 n9 R* W& ]; x}
* C) U0 Y3 ]! A3 a" L3 I  G9 y}/ a5 V( ]6 ]9 g4 q( D4 d* F6 O

5 D, L( d: I1 D! a- W8 a8 zif (iedom||document.layers){
/ N0 n( _7 n) _with (document){2 s; j5 o+ O7 `* I; t$ e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 M, ~" @% x* x0 G! t# h! O4 ]8 ]if (iedom){& z" b; Z0 e- n: n! ]# Q) R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 {3 P# i6 y$ H2 ~( D) `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# b' q" a; [+ e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ y1 S8 B! w! I# \write('</div>')
: T3 i3 m+ y4 P+ T: `) @5 {: l) P3 x( r}
4 v. M4 U% z! c( Kelse if (document.layers){" V2 a, B! |0 B) x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ b: J7 v4 C8 I4 U; e/ |- `1 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- _+ Y: C( G: `7 L/ F, J
write('</ilayer>')
4 S2 h( S8 h3 e& k: L) Z% ~$ m}
7 _. H0 N* {2 b( P$ ~document.write('</td></table>')
' @. b0 @) ]7 O2 i}
6 s8 Z. n+ A0 v* P' B}
% Z7 Q- [" D) y6 a</script>

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