返回列表 发帖

网页之跑马灯文字特效

//修改宽度! J+ z9 C1 c& S& N/ ^
var marqueewidth=300
# ?4 r; {+ \1 @4 V5 l3 |//高度
6 N# z. \/ H0 \( B( m' n$ `7 kvar marqueeheight=258 g0 J) G0 N) M# ^, X
//速度(1-10)
1 x8 n! t8 x1 d/ pvar marqueespeed=3+ f: X) l$ [1 w
//背景颜色3 |& B: g: H2 }2 f5 |) o! x4 C
var marqueebgcolor="#FFFFFF"
$ a2 B0 m6 p9 P& [) q/ Z9 c  _//是否能暂停 (0=no. 1=yes)?
8 z, A1 J- l6 R- g# t1 \, {var pauseit=1
% ^3 E6 u. R5 h" k' G4 S* ?6 g( }( r0 F5 M4 F
//修改显示内容5 |; w6 }$ G% M$ `& ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ F+ n2 S. U- A$ i- b4 ^) W, D
- |7 L8 R5 `$ I$ d  I7 u& z; Q+ `9 Q
////下面不需改变////////////
' n/ D7 r" V- Y
) d' N8 }8 _9 jvar copyspeed=marqueespeed
  ^7 a" U3 l/ B  c+ X" |var pausespeed=(pauseit==0)? copyspeed: 07 e( i0 ?+ U( z) C/ L' b
var iedom=document.all||document.getElementById0 o' x) s  o  Y# T* V) O4 @
if (iedom)
' h6 ~7 W: c$ gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% d! g( P5 h4 O; w  cvar actualwidth=''
+ J( n: p( Y9 C) D5 T7 @1 _var cross_marquee, ns_marquee9 w  V+ ~9 g8 ^) {4 }1 h8 S! v

7 Z+ v# j0 ^4 {function populate(){
7 Z4 C/ R# P" O; o! |- Uif (iedom){% m0 x8 i! S" u0 ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 }  N; F9 X* u5 F
cross_marquee.style.left=marqueewidth+8
1 J/ s' _. U# d* x* @9 jcross_marquee.innerHTML=marqueecontent
" W( b5 J8 U( e' T  D8 G, J5 _2 kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) m/ m. Q2 |" w& |
}
, ?8 @, g9 I2 l5 r$ C: Z3 ?: y9 Belse if (document.layers){
6 W% G6 S( @9 x! b  w  S; uns_marquee=document.ns_marquee.document.ns_marquee2) Y! I8 Z8 e9 ^% O; |/ N! V7 F0 v
ns_marquee.left=marqueewidth+8
/ S  ^' M% A- s  U) E$ f  Tns_marquee.document.write(marqueecontent)1 M2 [; l6 U( }7 d* U8 f; E
ns_marquee.document.close()
* W7 w( Z" u% M6 B) f$ ^+ g- qactualwidth=ns_marquee.document.width
5 M+ Y7 E; d8 h) k}# e! N0 V( q7 b' L6 B  q* C' B
lefttime=setInterval("scrollmarquee()",20)2 @, _* ]: \2 O; _
}
& c3 _0 `4 W& {2 G2 ]/ b- \: Mwindow.onload=populate- O( S( P8 m" O  c- d: A+ P
' ?2 g5 k8 k  l' h
function scrollmarquee(){
+ a( K9 i" Q/ F$ Eif (iedom){
) `( z( R; I/ [4 X7 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' k& T! n# C6 b9 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ b* W9 e* }& j1 ?) `( X
else/ A2 S  W+ X" G/ Z! Z4 }
cross_marquee.style.left=marqueewidth+8; y1 G2 I! j, F

6 W: L. `( X3 @0 j}
& e9 R- m  q6 L3 g$ j& Helse if (document.layers){+ f8 C$ |2 C5 r
if (ns_marquee.left>(actualwidth*(-1)+8))7 H( @. d. S1 z5 }) T
ns_marquee.left-=copyspeed
8 q. ^$ m& f: c# qelse
: M/ R4 t8 Y! _) S" Z  `$ E* ]& Z7 kns_marquee.left=marqueewidth+8
4 N/ j! |9 }: C9 t3 L}% `: C0 Q5 Z; O! K% O
}
# A/ @8 }) ~" z  L, O% ?; w: m9 ^
9 v5 H# v4 m* a7 [' wif (iedom||document.layers){3 D% I( x7 u3 H5 S, r" q
with (document){/ ^/ c# L3 m8 {4 Z* r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; A7 u+ V% I9 D$ ?9 u6 p: dif (iedom){
$ G; i$ b7 s; k: [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- V4 e0 D) L& U: X2 R4 {* awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& S2 V8 [5 Y! d8 @0 H- Z6 O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* e4 p* p* f3 g6 w: {write('</div>')
1 a" [8 o5 b8 T}
' r* v& z2 v2 p$ Felse if (document.layers){
1 q0 f# `7 i9 e( x% R6 Y  V; hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' w0 d6 C. q$ wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  ?, C( W4 T9 e  A$ g% }write('</ilayer>')6 E* a; M. a' H. ~. d! J
}  [2 f' z9 n! b/ j% p6 T; ~# ^
document.write('</td></table>')  J- ], s' N, B7 d6 E
}+ f/ p3 X) N/ a1 K3 ]& |
}
# c/ |+ W9 I5 o7 t; T4 z</script>

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