返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ R% ^' n% K: y3 W0 d3 z
var marqueewidth=3008 A2 a' H$ C/ `# p9 `, g( I) J
//高度2 e9 l# C2 B: L# R) f2 G" n
var marqueeheight=25
6 W# ?! n0 n* J7 K//速度(1-10)9 e" U: P# M7 H" g; Y7 N
var marqueespeed=3
1 \3 [5 p  C* D$ j6 z//背景颜色
' Y/ f( q" N, L$ ~5 r6 E7 \. jvar marqueebgcolor="#FFFFFF"# b! D5 l! V- B' T: C+ l5 ]* M+ g
//是否能暂停 (0=no. 1=yes)?
  y  K9 ?! m2 D' mvar pauseit=1
/ \: Z( k" O2 o/ G/ q" Y" V' n  R0 `3 p. G$ Z& a5 k( Y' i
//修改显示内容$ K" m5 u% T  a+ y7 |4 {4 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% S% F( }( b9 N# M
6 K4 N, y1 W. l& u+ f% G# k

& `2 Y' c+ S  T  t2 w////下面不需改变////////////
# N$ Z. v6 s* F7 j* l
6 o2 K" j4 J0 \" gvar copyspeed=marqueespeed* B+ ]  ~: Q7 C5 r5 o
var pausespeed=(pauseit==0)? copyspeed: 0! f/ j. d8 s* H( G: Q& y6 L6 v
var iedom=document.all||document.getElementById- S5 J6 P: V! X, I  [
if (iedom)
4 [3 j9 ~8 a7 e. @1 d: X$ bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 X' A/ M( Y  y3 u! ^
var actualwidth=''
# S, K  A) [3 e7 Z0 m0 vvar cross_marquee, ns_marquee
, D; S' ^1 p3 n& L6 I; O3 S! ^; y: _$ F" x
function populate(){9 b( i7 m- ~, E- M  A
if (iedom){9 V  o& f  ]. U; b' Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 r" q9 Z5 P( f4 j' w' j
cross_marquee.style.left=marqueewidth+8
4 c! g5 V' ^8 M  y; Ycross_marquee.innerHTML=marqueecontent
6 \, y, Y  i, b6 X, L4 i' a1 z0 [" Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. O' U9 V  Z# n6 K8 i4 ?
}2 `. Q/ g$ e7 w+ ]
else if (document.layers){, u3 `7 C! b4 Z0 U
ns_marquee=document.ns_marquee.document.ns_marquee2# o) ?  e( i8 M" z
ns_marquee.left=marqueewidth+8$ _3 O5 r  v4 V/ k& [2 S
ns_marquee.document.write(marqueecontent)6 T* R8 e- j0 s- z8 j4 b5 l
ns_marquee.document.close()
0 s% E. ~- z& |! O+ D/ u2 G4 hactualwidth=ns_marquee.document.width* W" t& u/ I/ |$ g0 Z9 e( M6 g: [
}9 a' R( C% E; M: D7 a4 b. }
lefttime=setInterval("scrollmarquee()",20)
+ l3 k% k) V2 Q1 i1 T}+ c) J! r- D% K2 T  Z
window.onload=populate
; P& d- f5 h1 G6 ]8 {" d9 G1 f: a2 \, l) D3 O
function scrollmarquee(){
) Q% {5 S  Z2 a  e, fif (iedom){
5 l. Q, p5 l5 E7 x' rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), l# A: F  Y1 s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' O. t  P/ \; {3 \8 F1 @* t, |else
" g$ B% U( o3 T' Y( }cross_marquee.style.left=marqueewidth+81 q; z, L% f/ `' A, U( M
. \( s" T' t5 B
}
7 ~/ @: D5 L0 s: Y( a, p* Helse if (document.layers){
$ N9 V/ B! |+ _- y. A/ k) lif (ns_marquee.left>(actualwidth*(-1)+8))
2 ?5 e% d5 u1 E" H4 N1 L* d+ ons_marquee.left-=copyspeed2 L0 F* D7 C% ?
else4 y8 w8 G( o& D1 S% g. W2 W
ns_marquee.left=marqueewidth+8
' v* ^7 E" `1 e5 Z8 E! g$ ]}
( k& P/ P* X! U* a/ J, M, `}
; e1 I; _& D3 A% f' ~9 C
7 U- x* W0 J5 O4 q  @if (iedom||document.layers){. L2 E, L: K8 t+ p, {; p
with (document){
& @0 ?; I9 t7 B6 N+ s9 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# o/ r2 z+ x: f" Hif (iedom){$ c: }- l# v/ t3 x/ y* @3 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 Y7 Q4 R' x) v5 U' m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 t3 G: O- b0 v7 h# }$ T, U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" Q1 d$ s& w: M4 }1 L! r$ R# I. Hwrite('</div>')0 Z9 F% i$ P1 @! A
}
7 k: Q4 Y( N# y3 F3 n( l% F* Melse if (document.layers){3 e( J* [3 k% V1 N& p% ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' E. z, E! O( u$ _0 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 @9 _( Z, t0 G* @write('</ilayer>')
+ F  h  ~8 O0 v& j}( ]$ ?( b2 e( [
document.write('</td></table>')
- y' C" S2 p' a- |- M8 F}5 h$ \5 ^5 q; V' C3 ], I9 \
}, w: x, S& E/ C- U; p0 R4 R
</script>

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