返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 N* Y+ P" S" l+ x1 l6 b8 Kvar marqueewidth=3000 s; R, @& D+ z9 g# o
//高度, f0 `: `& F0 _, V& M
var marqueeheight=25
6 l6 ~; Q4 K$ s+ F- V# f//速度(1-10)
. ~1 b. v% x: i, n7 I$ Zvar marqueespeed=3
% p( \) e1 `( B& R//背景颜色2 K- e. V: N$ w5 z
var marqueebgcolor="#FFFFFF"
, |/ N2 u. N9 E% Y//是否能暂停 (0=no. 1=yes)?$ x* z0 _& f8 ~% n4 E! n
var pauseit=1
" V4 s0 ?& O; K( X. p
9 b4 m7 C0 j) v  w//修改显示内容
1 E* c9 X0 ]; D5 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') Z/ D2 N/ l7 c2 O! S
: A. p9 G0 ^+ Z. d* ?7 z$ i
! \: n5 v8 j- D# I/ w0 U! n
////下面不需改变////////////+ x5 A0 a( R9 P3 P

* L1 Z' @  o- f& i7 ovar copyspeed=marqueespeed
; Q" \+ Y: T  a3 W! l7 zvar pausespeed=(pauseit==0)? copyspeed: 0& H" o( m1 m, Y' @7 z, u. J- i# _
var iedom=document.all||document.getElementById# g/ j% H" [: Q: \8 N; }& x
if (iedom)+ X9 w; `. d/ {& Q- x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  x; F  E; r# B8 n1 @. mvar actualwidth=''
% l7 O& `# Y2 l/ Q, x$ P5 o* evar cross_marquee, ns_marquee
1 U% r/ ^: U2 t7 {1 Y  j
' z3 ?, l6 Y3 T# h8 }function populate(){# U4 @; Z5 c/ L
if (iedom){
* G9 b; M! l$ vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 \1 U% i7 @+ N6 X* j" `: D
cross_marquee.style.left=marqueewidth+8
( {$ t* ], J* P+ ]+ tcross_marquee.innerHTML=marqueecontent
$ T# ^; g, a1 p8 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 Z' K2 Y, Q4 G9 p}
; W4 |( ^6 j* d( `: |1 melse if (document.layers){1 X( T; e2 ?. z5 f) t1 q/ L: u9 ]) E
ns_marquee=document.ns_marquee.document.ns_marquee22 l' I  M( T7 e3 h
ns_marquee.left=marqueewidth+8
) e/ X* [, R, j/ d- q3 xns_marquee.document.write(marqueecontent)' r5 w) u# T3 ~1 F
ns_marquee.document.close()5 K+ z8 s& r7 J# l! f8 D% t
actualwidth=ns_marquee.document.width
  ^! t6 {6 Y2 c+ t: l3 n3 |}8 g  D9 }, l" A6 U& K! R& z- ^
lefttime=setInterval("scrollmarquee()",20)( v+ s  u* M( n$ @
}$ }+ a9 g/ E, v$ q% F3 h6 b; B
window.onload=populate
) |6 v3 B+ |9 W8 C' U0 ~( n8 [/ U/ j# E# r' B0 Q
function scrollmarquee(){0 X2 _' I* l. ]% M! _- |  G* I
if (iedom){
& b2 `( B6 |; ?* i/ gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 E9 j% @! }2 ^# x2 scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  T3 Y8 C$ a7 O5 b. _1 |
else
7 H* c6 H, ]* J7 ]cross_marquee.style.left=marqueewidth+88 }) E2 z+ H1 j" y6 k

9 v8 E4 `8 r; F9 E7 e9 z2 T}
& f8 k" _0 X9 Welse if (document.layers){
3 N' w! ^$ L0 s0 E% \+ t* |$ yif (ns_marquee.left>(actualwidth*(-1)+8))
% O9 H( u* S( i8 T1 pns_marquee.left-=copyspeed
$ d0 D' G* y" g, i0 _, Q* `else
' |$ c2 a, n2 q/ @ns_marquee.left=marqueewidth+8( Y4 K6 `+ A+ F0 _, h
}
7 S7 E* A# D: {! I8 o2 P7 S}* ~& |. z9 v0 T" E

1 Y/ d6 C* }# a# T) Y* w3 {if (iedom||document.layers){
2 ^( D" {! L1 ~& |0 x% c: w5 s( y4 fwith (document){
4 ~5 S1 {1 k* R" N3 rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ b  @  s  M$ }* S* Jif (iedom){2 U  H1 c3 P( m2 G7 M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). l$ f! r# F& T! l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* g7 T9 L" }% |8 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% [6 G- x/ ?( y0 P6 t/ S( Uwrite('</div>')
, F! v# Y1 V6 g) E! h}8 g# D: A  z5 |& g- r: I
else if (document.layers){
) ~( i+ l3 B) i9 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 \6 M+ }: W4 l! x# Z" N3 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 Q2 A2 `2 j+ u4 X/ z
write('</ilayer>')
, a% k) k. G) `6 ]* H1 t}6 B" Y& F  \$ n% i. d
document.write('</td></table>')1 N8 n3 X. N" b. ~8 n- q4 r' E
}
4 t+ {5 c, B6 L1 q2 o  B}
+ B' ?5 `$ [: k( }</script>

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