返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 z& G0 ^+ ]* O
var marqueewidth=3000 m% w3 S, |- W" p! C/ \
//高度
( {- _- P- _$ Y2 ovar marqueeheight=25
+ ?- H8 M/ J$ x1 ~//速度(1-10)  S: [$ k' C7 M: a5 Z, @
var marqueespeed=3
0 n+ R7 K& S( k2 z( F; V7 r. \//背景颜色
: J6 t$ ^/ @7 ]% Vvar marqueebgcolor="#FFFFFF"
5 x5 e  K3 |; G" R7 ]# A; w/ _, Z- N//是否能暂停 (0=no. 1=yes)?
9 w" f% g2 |. m, Q  v) ]var pauseit=1
6 ?2 ^, A$ n2 v/ i( Y
" b% j  h7 m7 D- i" i4 ^9 a//修改显示内容
7 M  i. ~1 y% @4 G8 l! h1 [$ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 s2 m+ [7 G: \+ n" I0 B0 B5 l, M/ F: ^! J+ @8 x/ A4 s% d+ m

# e  W! T, x, Z- Y////下面不需改变////////////
+ V. u1 |1 m" F  G" S7 J# r! Q4 s0 J: r1 W. M. d6 X
var copyspeed=marqueespeed
" f/ d2 e0 g" ?var pausespeed=(pauseit==0)? copyspeed: 0' R0 ?& N0 h" |+ W; _0 H2 F
var iedom=document.all||document.getElementById. P6 t* K) T% a0 \9 Z/ ^, ^  W- [
if (iedom)8 x1 y( \, G$ o4 _# i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 w8 b& J& S* J! S
var actualwidth=''$ v( J% h4 f7 G/ k6 h7 A$ p
var cross_marquee, ns_marquee) c* @$ _$ L& T' A" Y$ H

2 _) x" o/ o4 k; ]$ r' |9 F7 Rfunction populate(){! I/ F( H/ I3 l6 ~5 c8 D3 r2 N/ }
if (iedom){( W( C+ r7 ^( `$ s1 B- n6 w& b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& \0 g  _6 [8 R
cross_marquee.style.left=marqueewidth+8
. {) D* j" d' Z( E! {cross_marquee.innerHTML=marqueecontent
% r+ w+ f9 P3 A0 V1 D' F9 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 Q- l- l# d" Y) A. x( [2 g5 Q
}
0 I, Q; f8 O! a/ m1 relse if (document.layers){
) X" w) B0 c* t7 t6 yns_marquee=document.ns_marquee.document.ns_marquee2
, G' l  C; ]$ Pns_marquee.left=marqueewidth+8% A7 e0 }( f. G
ns_marquee.document.write(marqueecontent)9 m9 b8 u5 Y) _; i, r8 T: N0 u
ns_marquee.document.close()) q) }- ?- j+ ?* @( _- k/ I, b0 H, ~& _* ^
actualwidth=ns_marquee.document.width
/ o1 W4 a1 f: v' i# ~}. O8 q/ ^( S# l! x* M
lefttime=setInterval("scrollmarquee()",20)$ b8 q7 X$ ~( m! P; U
}
# w. K( v* v) b1 V6 [  Ywindow.onload=populate
* s( i  U) u6 u) H; m
' H7 e1 U) o8 f+ E# [( Lfunction scrollmarquee(){
$ q) M7 c2 J( d3 y- L- [/ Yif (iedom){
1 K: G/ ~8 l3 H3 [1 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% @6 R! ]) o" a1 Z0 O) Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% r4 q  T! A! L, v2 h$ s7 n) Xelse
% I, e# t8 A9 P+ M% }' zcross_marquee.style.left=marqueewidth+8% K% {9 J. c" `# L

/ J/ A6 Z# S% y}
0 [# J/ ^6 `( ]. w* e4 Telse if (document.layers){" d7 o9 R4 y& b$ q$ }0 F
if (ns_marquee.left>(actualwidth*(-1)+8)). k- ~/ j7 g" t) Q4 C
ns_marquee.left-=copyspeed1 G( r8 ?6 [$ i3 d1 @3 I5 A
else
5 ?+ R4 H, r& p7 [ns_marquee.left=marqueewidth+88 o# t* [* h0 R4 O4 L1 D7 W
}
# m2 Q1 \; F3 P5 F0 ~}
; H5 |9 l1 M: ?
% {9 q" \5 V6 |3 Q* Vif (iedom||document.layers){$ t8 |- c9 \, J6 ?7 |
with (document){' g" q3 I0 Y8 z& v6 s8 c6 t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  n! W$ c! o1 t% x: Y3 S
if (iedom){
( R, G  y  f+ |9 s, Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% `! v5 `0 D/ c! S( @) |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& K6 R8 F& b* n2 d$ qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), u# G4 a( z7 H4 u7 V# P
write('</div>')9 z& s  z! k/ [6 F: @
}
9 E1 \6 g  ]3 X6 }else if (document.layers){
, l6 b( f" A* ?( zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 E  I) ]2 B9 M. F+ fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! p( `9 z5 ~/ G3 o. @. r1 H
write('</ilayer>')
) F/ ]8 t, ^: N}% e2 j3 o* X* e1 c. W2 H
document.write('</td></table>')
9 _8 v3 `6 ]4 e3 ?& h}/ w5 |5 Y- R1 ]. ^! M" d: H
}  U: L! y: p( r9 J, c, i4 L1 K
</script>

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