返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 y6 ?# t0 \3 k# W
var marqueewidth=300, g' x5 _3 t& w# W/ |/ N
//高度( z% f, N( R% _- f3 T4 d- {$ m
var marqueeheight=25
0 N# u4 m  g* K# T//速度(1-10)
& ?! W8 {  S% o7 {/ v: i: Q% cvar marqueespeed=38 b0 l# ?( v; X
//背景颜色+ f6 a6 P, ~5 G( h) u2 ^
var marqueebgcolor="#FFFFFF"
4 Q! ]) v; j2 _9 f& G) o0 B+ i//是否能暂停 (0=no. 1=yes)?7 @& }3 F1 S4 W3 K! t% Q
var pauseit=1; h9 q6 y' U3 B

# m- N" i6 L3 [- ^! G1 [//修改显示内容2 G( z( f8 t' o5 i9 o; D+ _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, |, T2 }& l8 e$ W( B6 |3 C* K2 Y  ?0 W1 m

: t. S0 D: D1 z% J2 d, n////下面不需改变////////////
3 }* r2 v; }: V3 |0 P: g- e/ S
9 Q: M8 z+ p2 Mvar copyspeed=marqueespeed
" l' s' j/ ?+ i5 |var pausespeed=(pauseit==0)? copyspeed: 0: H& Z) c) J! |
var iedom=document.all||document.getElementById
* g2 T8 c- U# _2 f0 A+ J4 tif (iedom)
9 u6 ?! V+ q! d: W5 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- f+ b/ X% {* S  f. ~; J
var actualwidth=''! |3 l) ~4 s! p; W: Z
var cross_marquee, ns_marquee
% T+ h" f  O' I9 m$ i% [
0 v0 U# a( I$ v- _. c/ P+ E  N5 |: Dfunction populate(){+ b( N* N9 K$ y" x$ Y
if (iedom){2 E. M$ ?4 }9 n5 z! E; N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 b, S7 u" M4 ^, j2 kcross_marquee.style.left=marqueewidth+86 H8 K/ h  }. h# L
cross_marquee.innerHTML=marqueecontent
+ b3 j: s" ~# r, Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ y- N; Y' N( Y8 c}
( [/ {: i1 q0 ?7 D! oelse if (document.layers){
2 j9 c+ X$ v/ P! t) @+ e2 `ns_marquee=document.ns_marquee.document.ns_marquee2
9 x- Q2 \6 G) f" `6 B) M8 ?  fns_marquee.left=marqueewidth+8
% U( J  V% A7 v1 m# U4 ?7 i" T9 ?ns_marquee.document.write(marqueecontent)
6 `" S4 w! d# u# g! ]. t6 kns_marquee.document.close()7 k$ m, Q- V- _: R: b* @
actualwidth=ns_marquee.document.width. P1 o; c( B* f% ]5 z0 T% o
}9 w- o) m9 D0 ~" f5 I+ E
lefttime=setInterval("scrollmarquee()",20). K1 J7 v/ E6 J. V& F
}
& w2 K- J) D5 `window.onload=populate* W" }# y6 e, \5 `9 y; i

+ y0 y/ R5 Z9 Z$ J( f: ?. C6 mfunction scrollmarquee(){
, |3 r# s8 [& [' v9 n8 Yif (iedom){
+ r5 |9 u2 j$ d; p% Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- x- [- S+ Y0 y9 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- T/ s$ X7 [+ `5 m2 h! b
else
+ ?& z$ r: ?7 U/ I* a% ucross_marquee.style.left=marqueewidth+8( \- w" z9 d. H5 f" ]

5 n6 X# ?7 D; r4 i}
$ S( ?# M+ P0 t/ r; d' v8 |% [else if (document.layers){
6 B, O" H( q: I+ }; `% S2 W! }if (ns_marquee.left>(actualwidth*(-1)+8))
# v; _6 ^( x$ S" N' Xns_marquee.left-=copyspeed
( a* k* \8 l+ I! |# D  celse! ]: S! N8 U2 f  c* v0 s; e& a
ns_marquee.left=marqueewidth+84 M) H: Z  R$ a5 q  b) X* q; A
}" Z  g! z, Y6 O7 T) V6 E4 n
}
/ m/ H" W- L9 W) l7 j# W9 z* ~+ ]9 l2 J% a4 F5 s( h+ R
if (iedom||document.layers){; S+ @  t* y7 F7 z! Z
with (document){
, \& H& F8 j( Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 @+ q7 ~" T7 B7 U3 }  o  Cif (iedom){4 _8 M1 d! l+ ?7 }6 x2 E6 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& Z) q8 W+ ^0 P& Y9 |/ c( S, ~9 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): |. f1 S) ?2 O" t# P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# d6 ~% r  S3 z; B7 T6 ~write('</div>')- `( J; Q" F& B, R4 F
}7 n5 h- o0 I! c' |0 d
else if (document.layers){
9 u4 S+ D, ?$ v: d0 D+ H  A/ ]$ Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 q& {0 k, V- {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& a8 h! b5 f% l  T% `write('</ilayer>')
; M' g% a7 o7 w, w* L% s. a}
- t6 p% d5 ~  _document.write('</td></table>')$ }: n9 b, A' @; f; M
}
4 s3 d* j; ?; o* d}
( i2 Z3 P9 |3 i3 f" X( P</script>

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