返回列表 发帖

网页之跑马灯文字特效

//修改宽度: M* k9 x" W. i; Z2 P' l
var marqueewidth=300- Z* a+ W/ V/ {+ Y3 g; ^9 r7 K
//高度3 e# i+ \) N1 Y, i9 ^9 W
var marqueeheight=25! V1 E! v) {* b# s
//速度(1-10)
2 i+ J8 r5 I, u( Q# |, r+ ?var marqueespeed=3
2 o" |9 E% i' i$ b$ K, r- a//背景颜色
9 Q5 A+ p1 [$ G# v% n" ]var marqueebgcolor="#FFFFFF"& W9 z' a' L! b3 o; Q. k' E& B
//是否能暂停 (0=no. 1=yes)?
8 X8 [! o- ]% H& M6 ~& vvar pauseit=1/ V5 Q/ Q% W8 ~$ q* ~
: ], N+ E/ ^$ I& w1 F, l+ {( U
//修改显示内容
9 O1 V% w+ a7 D, a8 r1 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 |' E7 F% I3 X( b+ N! i7 e( x8 n; Y, [3 w( i! B& A& G7 K+ {

9 `1 a# I! o% L7 Y////下面不需改变////////////
% N0 C8 u: k: q- n+ z
. y& I) W* V9 Y7 ^+ uvar copyspeed=marqueespeed
7 J2 }' w- b& H- vvar pausespeed=(pauseit==0)? copyspeed: 00 m. A# t1 q- T7 e4 ?
var iedom=document.all||document.getElementById0 S8 n1 }4 G- l1 E# K
if (iedom)! _! ]; V; h4 K/ M  V4 Z3 A# M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! S. }% F4 S5 R8 K3 A9 O( |var actualwidth=''
; z  }/ G2 m& M! y. |4 f) Wvar cross_marquee, ns_marquee2 v( p- P/ k$ y4 R# l4 z! d

# \6 q+ L# {  ffunction populate(){
$ E2 Z3 k9 y7 q8 r% U4 E: J  xif (iedom){; j8 ?/ B, e- }0 ~: c/ W. A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) q' k: ^6 f/ d2 N3 d2 |- L
cross_marquee.style.left=marqueewidth+8
8 ?0 c; I5 p( h& _' A( i, ^0 e- Ycross_marquee.innerHTML=marqueecontent  _1 Z1 P' d3 m  s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 A' m: J) G; B- I
}/ b* ^; z) |. M% p
else if (document.layers){
& u: K/ M4 B5 Uns_marquee=document.ns_marquee.document.ns_marquee2
6 E7 w; O9 |6 _ns_marquee.left=marqueewidth+8
( P" W' o7 F, x5 n, P+ b5 Dns_marquee.document.write(marqueecontent)1 @6 F+ ]# C& x
ns_marquee.document.close()+ v7 m  j' `$ Y5 T( s
actualwidth=ns_marquee.document.width
' m5 s8 x! X4 f* [; d5 t, p8 }}% l6 a" E7 M9 a5 ^1 E6 a6 Q
lefttime=setInterval("scrollmarquee()",20)
7 P6 \4 i, b3 ~1 C}2 g  }! r4 c* _1 J( ^4 L9 O
window.onload=populate0 g% [! M0 K0 X5 n5 N0 D
! S! h. k  @3 k6 x, O) {+ }4 R$ Y
function scrollmarquee(){
, W+ n8 q$ V$ p' X0 W+ Y7 kif (iedom){; h8 m  W. o  S8 z' g& ~' B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* w' i, J6 c0 H% k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- O8 M+ `3 b! u+ A- u( W4 k0 X
else
% r; L6 V. K6 r: O: d0 d/ C9 Ucross_marquee.style.left=marqueewidth+88 {; Y+ p  y! K& v; N: K

. K- q  k0 l, ?9 S- [) p3 J, q}
9 a* e- T! O3 n8 c3 S9 l5 Y- ^else if (document.layers){
: w; {: V& F" e7 P( S$ j. b( @" Kif (ns_marquee.left>(actualwidth*(-1)+8))( I* X* K) p' o3 \
ns_marquee.left-=copyspeed
. u1 ?$ _) q$ j6 f1 S+ b( R) Felse
1 C# J1 p& ?  U, jns_marquee.left=marqueewidth+8+ w& l) `8 O2 ^' [" b: W8 h1 D
}/ j1 }; K3 e; v1 O# ~, j7 {! z+ e
}
2 A+ s0 w1 K& ]  Y4 L
# x; a$ H6 F& k+ T3 w( iif (iedom||document.layers){1 j( x# T' |; `1 k' I4 Z$ G
with (document){" p5 z5 d, T1 e4 v' r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( t. A8 m9 x3 ]$ L# e) w* M6 B
if (iedom){7 N$ I) b+ B+ `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), V4 O* ^. B) i$ |! \/ ~4 n3 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( m7 r8 p6 r9 \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 P' V& d( h6 R8 H6 L! g
write('</div>')4 s& b0 N) J4 \  n2 J
}
7 V. j( j5 K0 r4 Oelse if (document.layers){5 Q$ ?; @' t$ s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* g0 ^+ V% q$ \( r, K; m6 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 \; `4 [! L: B- B$ c  I2 t
write('</ilayer>')% z! a/ r( t" V+ Q9 f
}
8 G+ u2 k* X9 R, Cdocument.write('</td></table>'): U7 u9 F5 k. G
}3 l# A1 Y2 ^1 ]3 {; Q3 b) v
}
% [% h- s  C0 g% G" s" w2 B</script>

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