返回列表 发帖

网页之跑马灯文字特效

//修改宽度) J; {" o$ \4 \7 [% U; a
var marqueewidth=300
9 P7 d  _) C5 H/ a1 l" q//高度
& m' r, P2 V& b% [3 rvar marqueeheight=25
) e) K  l+ Y1 H& i1 j//速度(1-10)
5 Z. R9 I% _( U) @7 f; hvar marqueespeed=3
/ S% b7 k, F, Z, Y6 o7 I//背景颜色* G9 V* F4 O; s; _! s6 S- R' C
var marqueebgcolor="#FFFFFF"
# V) c& X# y4 A1 b8 b//是否能暂停 (0=no. 1=yes)?
8 o& V+ ~8 H7 R, @3 m; m) `# gvar pauseit=1
  \" v$ M+ g* J9 @4 z
3 I: p, B$ [) K9 _5 e! f7 L, `+ t//修改显示内容; D5 Q' O& t8 r. x/ @, A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 i1 d0 J$ O2 i: S/ w% [& Q! x0 {7 w5 ?% X
& }$ Z" n! v3 u7 D+ Q
////下面不需改变////////////
3 F. Q6 T2 ?! k3 @% k$ q2 V( J% d: @
var copyspeed=marqueespeed- X5 Z& `0 D4 @. I0 Y, Z
var pausespeed=(pauseit==0)? copyspeed: 0* u6 h% Y9 N$ S7 `. e7 @! T6 y+ o
var iedom=document.all||document.getElementById
* r+ ]# N' Q, |; c& ^/ jif (iedom)9 ^& l/ G  f# R% E8 ^7 s: j# o! j$ r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 L$ q4 }& D  l! Z9 m3 Lvar actualwidth=''/ r$ s$ V/ N9 v. @9 F, r1 P
var cross_marquee, ns_marquee  F4 C$ M9 x* a$ i) ^+ [- R

0 c( s- n6 m9 X- A/ w% b% L: ufunction populate(){
* {8 k( B2 u' ]1 j6 B0 Kif (iedom){
( \8 [. z7 M% T9 Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' H) h: \6 r3 r- M2 T) P* b* t. |7 q; ecross_marquee.style.left=marqueewidth+8  x/ R' m6 L0 O  N" \/ T% I
cross_marquee.innerHTML=marqueecontent5 e" x% M- Y/ f8 [7 U. r' d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. ^3 z% \& f3 s+ I1 J
}, Q! j  L) V" \2 t
else if (document.layers){" u& C( H) U8 X! I- s% L
ns_marquee=document.ns_marquee.document.ns_marquee2  C) q/ e  Y9 p' N
ns_marquee.left=marqueewidth+8
1 c& R5 N/ T: f. r3 E- w3 C) h; @7 {ns_marquee.document.write(marqueecontent)+ @' k9 W/ z& |. j4 I
ns_marquee.document.close()
( k$ z* S3 X; P9 wactualwidth=ns_marquee.document.width
2 N1 B$ u) H* ^) _}
, x* L% F; Z  C/ d" @+ Hlefttime=setInterval("scrollmarquee()",20)/ o  v9 q+ Y# k) T2 r7 z
}* ^% z4 F  E4 N( R3 ?. M3 e* A
window.onload=populate
  T; t. L8 T  y8 V2 B+ R: @6 M- Z- i9 s% `$ g
function scrollmarquee(){
1 o! w, r0 ~( s0 I0 o6 A' Uif (iedom){# U( D- S: }& }% M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 t+ L8 `3 ]1 q/ B5 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- a( o$ P5 q/ \9 s2 [' L
else
2 c: x2 [; P0 k3 }; r3 Hcross_marquee.style.left=marqueewidth+8
# h4 \* C, v6 c6 G" n- x  V; Q! g" i6 i# `
}
) R: l: f% [, welse if (document.layers){
1 c2 P/ |+ X- A! |( W  wif (ns_marquee.left>(actualwidth*(-1)+8))
6 q) L1 ^  Z. lns_marquee.left-=copyspeed2 d, ~# u. ~/ p9 o8 d7 e2 v
else6 V. K3 n) E3 W' n/ N: V! C
ns_marquee.left=marqueewidth+84 {# |* b: s) z, z5 c
}
  e' F) E" U2 P8 |: N' {}
0 S6 h: V' a, C9 ^& G7 Y
  G1 C& O% ]! t5 v( Gif (iedom||document.layers){% |1 L0 c8 G' ?+ s
with (document){
9 @1 f- h& E6 D/ ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 {, i9 {6 Y4 y% V3 P  t: J
if (iedom){
0 R2 O4 A6 i  x5 M9 s& hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( h! p6 \; t. k' G6 ^$ Y8 L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 q* t) }) P- _2 Y; j) Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# x/ L& m3 Z" f  h1 ~write('</div>'). c: U9 k, R! s5 u! T7 J
}: p5 y4 M. V* i% b2 ]0 K$ c  i3 W
else if (document.layers){
. @7 K/ n! z7 |  J5 A0 J& N! A3 J$ Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 p# ?6 y0 T! _: ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ c9 j, ?  q/ i3 f( R
write('</ilayer>')3 S! x) p+ L! }5 F4 K( e. h
}
+ O5 H& }( @" s& {document.write('</td></table>')1 E% Z2 A8 J. v' ]9 H, l9 q4 Q; e
}
/ c' \9 c: Q2 w$ h! F}2 _9 G  _7 v# C' g
</script>

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