返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# w5 H) g1 L3 Z8 i6 }var marqueewidth=300/ h  ~* s4 K/ Z* P6 z8 d
//高度! {, z4 V% |9 _  x; d  W
var marqueeheight=25* p, O7 s! K$ v4 F& @2 l/ ]# V
//速度(1-10)
% u6 T, w3 Q0 ivar marqueespeed=3
: a5 z3 F) `) h6 M: L# |. X- |; p+ ^//背景颜色: J; ]2 ~6 ^5 S: M+ t  Q
var marqueebgcolor="#FFFFFF"& c% J9 I5 v) `9 h
//是否能暂停 (0=no. 1=yes)?  {6 ]7 q6 N+ z# U' |: @) f; Q
var pauseit=1
( u& n9 J7 Y0 B7 @& c" c1 I+ S$ s9 G
4 y9 t, m) X  G1 t  l7 r//修改显示内容
" v' U8 [- x4 i# d2 Y6 A% hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( X6 f, ^  O# F% W( l; O4 @5 V' ^9 H
- _5 i. j& p# b, d6 ?, v( E9 O0 F1 @! E
////下面不需改变///////////// ^4 s$ y+ Q$ ^! u1 Y
& V* P/ z1 S6 Q2 {8 ?- U
var copyspeed=marqueespeed# F( h2 y( Q8 ]. h6 k) E: A; [' y% r
var pausespeed=(pauseit==0)? copyspeed: 07 W; k" X! v6 ~3 W2 m2 `: _
var iedom=document.all||document.getElementById
2 x/ u, t4 b! X8 p2 ?if (iedom)
2 }+ S, ?: ?& M. [- x1 vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 ]1 \# C; v' I- q1 Z' J2 Nvar actualwidth=''
; v7 C6 Z+ c, ^0 Zvar cross_marquee, ns_marquee
# \- v. q: c$ R6 u1 t- L
/ T+ D  S3 g* D2 c  ifunction populate(){
9 Z& W6 I; C% Fif (iedom){1 F# D4 r7 t% m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 q5 O- ?9 D& I  m5 V
cross_marquee.style.left=marqueewidth+8
1 u. k* P/ y: S) ~, x9 scross_marquee.innerHTML=marqueecontent* d! ~0 C: x+ Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  g! v2 T# X3 y" E3 B' k+ J}
( c: i1 `. `$ h/ Jelse if (document.layers){' I* |7 I2 i7 y5 y4 |3 B1 v
ns_marquee=document.ns_marquee.document.ns_marquee2( O* d: m! b4 N) a. ?  |
ns_marquee.left=marqueewidth+8# ^5 t" b# F# s0 Q0 P  _3 R& i8 @
ns_marquee.document.write(marqueecontent)  X2 `. b# S3 B7 B
ns_marquee.document.close()# B0 p# `) o1 e: O& ]
actualwidth=ns_marquee.document.width
7 g; s  {! `" {! z. e9 u3 O}" u/ i9 u: h& F7 ?
lefttime=setInterval("scrollmarquee()",20)6 {+ P3 Q9 l) I$ e
}
( s$ \2 `5 |  \7 H; i" q6 Gwindow.onload=populate
5 x' I1 ?$ M# K  \2 ^. E% L! c
8 W5 `9 d  X6 i) qfunction scrollmarquee(){
" F0 f$ E" }2 qif (iedom){
/ L) E- i1 s) O7 k: Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( ?3 M- t. w, O7 l. U: C6 o) G  I5 K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# S5 e% E, D, E0 v9 b
else( n2 c( ~/ z* t! h( u9 T# d
cross_marquee.style.left=marqueewidth+8* h, }& ^/ H% z6 g, b# _
( E& Z3 j8 `8 a( `
}( f. l/ M# U6 B0 R/ y* l: f
else if (document.layers){% E* @1 U& C; W0 {5 h  @& P
if (ns_marquee.left>(actualwidth*(-1)+8))
5 W5 n& |! u+ O. p. x% v7 C: D% sns_marquee.left-=copyspeed" Y& Q* V; q  J
else3 [! K/ \3 S5 S0 U; j
ns_marquee.left=marqueewidth+80 \8 j& S' u. N3 [; j9 b3 m
}7 _$ \2 m/ O$ C6 H3 T
}
. L% Q0 X) g7 d3 _; f# R/ _8 |9 F- H. s  v) `) o5 T2 K8 D" [
if (iedom||document.layers){
# Q( v. [" g  u4 `( Q. ?; j$ I& B2 }with (document){
  S( u  l6 t. _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% `; v4 g! k8 h  @: g! s, |if (iedom){
: S. f4 ]; D& K& P) Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% a4 T% q1 p% _. M9 L) e- j9 ]) a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( Z3 \# l/ f' Q  q2 _9 _3 P; X$ V; q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 R5 x7 n' s$ K5 k2 f& t
write('</div>')
) ]! ?4 a3 r. s* S1 g/ Z}
+ Q; K" ^! ^* k+ I8 N- welse if (document.layers){# ~2 t/ q8 q2 Q& B: r! J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ i8 ^) I: _5 c5 x: W- q' y7 d; C! R- Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, y. a, Y& b% F0 Swrite('</ilayer>')
8 U8 T/ w* K& ~}
# w& z. e: D+ o% [$ p% h+ H! [1 Udocument.write('</td></table>')$ p# Y% C. S) x; O
}# O' c2 M$ I6 T1 f, W2 ^
}, t( H9 F6 |: e: a/ N; ~3 G
</script>

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