返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 X3 k# o$ z1 c
var marqueewidth=300! ^, Y/ W3 Z+ ~7 s* j
//高度& o6 |7 I( }8 x
var marqueeheight=25# z7 i# `9 p4 Z0 D7 ]
//速度(1-10)4 t7 v& d. S9 ?
var marqueespeed=3# W; I, @1 b, t; K
//背景颜色
: m6 @  k, l0 s: avar marqueebgcolor="#FFFFFF"6 E7 y2 X* S0 ^2 J0 y
//是否能暂停 (0=no. 1=yes)?# o  k6 w) T! G
var pauseit=1. T4 @, f6 H, A1 R( M3 T

3 o' _' L; L* x$ ]- P//修改显示内容
/ |9 W& Y: v' w* ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 L5 ~4 Z3 y# F" g6 I" O4 E+ g/ ?
: r& R. A2 D& b( r
$ N5 R% \# R+ S! [/ |! @
////下面不需改变////////////0 e$ r% z6 r/ d( c7 L

/ ~3 D" D2 T. z' U% l7 q0 E, h" |var copyspeed=marqueespeed
0 @6 v$ U7 C- E% {var pausespeed=(pauseit==0)? copyspeed: 0
% i( O" \# [7 `* Z" @4 }var iedom=document.all||document.getElementById
! k1 b1 r1 P* `2 H# R2 m: t3 iif (iedom)
3 Q8 ]& Q' [* O; R2 V2 \5 {; ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ w: ^3 X  k% X2 O$ c! o
var actualwidth=''
4 J8 G; `* {2 B$ lvar cross_marquee, ns_marquee7 N: {0 X- D. Z0 J
) w0 A0 l0 `" d. [" ^4 o
function populate(){6 ], C* b" }2 }( C# f- s; V) y6 k
if (iedom){
5 E. f9 o$ T: fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 q/ D9 N: z; k  `: f: I, ucross_marquee.style.left=marqueewidth+8
+ H: O* y! q+ }4 Vcross_marquee.innerHTML=marqueecontent
; f! W0 c* V3 O! y1 Y  L7 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  E; ~! y6 H( c* w6 q* F, }# V
}
/ e; Y) K8 f4 A' @  E# pelse if (document.layers){
; _% g. L! Z1 A( S. ^( ons_marquee=document.ns_marquee.document.ns_marquee2/ L  B3 c" ^: L
ns_marquee.left=marqueewidth+8- h4 j! l1 N/ V6 t
ns_marquee.document.write(marqueecontent)3 E$ P' v: ?  f$ N( `6 V
ns_marquee.document.close()- {% K- K! d; R+ r, S) Z
actualwidth=ns_marquee.document.width( n  x, P" g5 X+ r, A
}
  x+ \+ L) d- D. blefttime=setInterval("scrollmarquee()",20)
' B' ^# I& ?/ T}: R! P+ t/ Q! _7 k3 N5 p, M
window.onload=populate2 E+ y) R) ?( ?5 c) Z6 W+ d2 m2 @7 B
2 y. B) o' C+ @& x0 {( f  l7 f) T
function scrollmarquee(){+ u3 Z- |* {0 T9 n. q, b# F
if (iedom){. G# _* U2 b! a9 v! T, [+ j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( e7 f" W3 ?6 @4 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 j+ @! a( s/ Ielse( w2 h( l2 e  O$ ~. T
cross_marquee.style.left=marqueewidth+8. J" s& E$ t4 v3 |# Y6 d

  L* v. g' s3 \8 Q}% y$ s) S+ s3 b# j# M1 V. }1 g; C9 S
else if (document.layers){
8 w. S" Q0 w7 K8 i0 Y+ c) w) o7 dif (ns_marquee.left>(actualwidth*(-1)+8))( Z1 ?- Q% z3 L  T  i7 R' B& m) H
ns_marquee.left-=copyspeed
1 n% _: I: T4 E3 h1 m$ welse4 c4 L4 k+ |: A$ u
ns_marquee.left=marqueewidth+8( y+ y8 u1 ~" Z! x4 _! D: @
}
# G$ g: d1 J+ x# G# m; j# {# W  a}$ \9 M1 }4 g/ j1 B  ^7 l

/ a; M. Q* {2 _; Q7 H$ E* Aif (iedom||document.layers){9 ~+ M, n4 U5 {
with (document){
+ `! d3 x9 o. @  L& ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 i# [. n  U- G1 G8 D' F* kif (iedom){. [$ s& Y% w# t% `8 w4 X% t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 C7 T# ]7 O5 O0 l$ B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! J6 V+ d7 [! u: u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 q) \& `" H0 D7 kwrite('</div>')
- p" \/ D( [  W}
* x  n. I+ l$ |6 o" m3 belse if (document.layers){
/ p" c, A8 n5 u6 ^4 a* f# Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ A( C. d3 s' |! [4 k7 k6 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" g  H* S. E$ m7 E3 I, q6 a
write('</ilayer>')
4 v' b# U8 l; S: r0 m5 T, v}' E1 k' K- k9 u* ~& D0 [
document.write('</td></table>')5 o% |% K8 O: b8 ]
}/ U0 d) z/ \" f- Y
}
, `6 h; [; K+ T</script>

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