返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 U6 |" l9 D1 {  r) g8 I
var marqueewidth=300. P# f$ G2 Z! _8 t) |; K, H% B
//高度
+ m6 r" I/ |$ T& N; q' B* Wvar marqueeheight=25) ~9 j9 G  P: [  ?/ t6 H
//速度(1-10)
. Y) z5 u8 F3 [. F, t6 Dvar marqueespeed=30 O! N% y1 u$ s! }* K
//背景颜色
0 i* g" J4 M3 n4 N) avar marqueebgcolor="#FFFFFF"
6 B. d" H! D$ S% D7 h//是否能暂停 (0=no. 1=yes)?; n1 J9 P, w: t3 p) v
var pauseit=1
, j5 s6 m. Z. {3 A9 y& s& v4 \: u/ u8 I) o+ b
//修改显示内容' L3 Q, k% |- e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ^, O! u! }% Y, l1 T# J
2 |8 e0 L8 e9 r& w. h

+ I( w' K4 [7 C- i7 K+ A////下面不需改变////////////. P! E" @1 X/ t: q# p
+ W4 f" b  x8 P4 S
var copyspeed=marqueespeed- @2 u3 ?# W8 p  G. L
var pausespeed=(pauseit==0)? copyspeed: 0( Y' E1 j5 o; t9 e' K" d: R. S2 B
var iedom=document.all||document.getElementById8 o8 @; W: ?% W; U6 m# f
if (iedom)( g! Y- |) ~0 R$ ]1 q2 X& ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# H7 i( E- Z* b4 Kvar actualwidth=''
* R- ?# w7 D/ P9 X3 kvar cross_marquee, ns_marquee9 f; B: p* y1 K2 L0 f8 o$ l* X
# ?: w; k- ]2 C+ B2 ~8 t/ R. V" ^% t
function populate(){
8 i" n( @& B: ^  X/ r+ |6 `if (iedom){1 a. D4 a/ U- C* \  {0 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- D" v3 \2 R0 N+ d: A& a! m2 P
cross_marquee.style.left=marqueewidth+8
6 T! T. \1 ~: }; h2 ycross_marquee.innerHTML=marqueecontent* h2 ?# Y: Y6 q1 {6 ^4 n0 w# ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 K+ U' A7 q& _! [}
6 }: j1 k  {1 \4 telse if (document.layers){% ^1 T3 I  n: k9 x, S5 m
ns_marquee=document.ns_marquee.document.ns_marquee2
3 A. h( P8 ~) T1 a6 p. s2 M$ uns_marquee.left=marqueewidth+8
% q* r" r9 E5 L& W) g4 Wns_marquee.document.write(marqueecontent)
$ {7 N% o9 D  hns_marquee.document.close()
9 X7 n  d7 A& h5 e9 ^5 Oactualwidth=ns_marquee.document.width
7 I; ?6 m! R& U0 z2 D}, S% Q, n! x1 r1 K. d6 P
lefttime=setInterval("scrollmarquee()",20), |" G  g& e  q) P( V4 f
}0 {7 l/ t0 W. A
window.onload=populate. r- V/ t2 s: d0 ]# U

, R: h$ K2 S, S) h! Ofunction scrollmarquee(){
# ]! M& Z$ ?4 |* I9 S4 Z+ Wif (iedom){* J2 {; ?) @& `9 O8 y( |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 x# O8 y# _6 b. R/ V  ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 c0 b/ q9 F; ^4 A- x
else
  I4 h2 u& G% k' ~; d" k" hcross_marquee.style.left=marqueewidth+8
/ n4 I) V1 \+ H& N% R" A8 j0 @3 D* X( H3 m4 j( ?. Y5 G
}8 ~6 }8 S, P1 f& U7 ?
else if (document.layers){. a/ A! T! q+ h/ d# U: h
if (ns_marquee.left>(actualwidth*(-1)+8))3 m8 H' ^+ O/ A! r; q# j
ns_marquee.left-=copyspeed1 y) X( s7 I# R" h# R; ]
else" S- V4 [0 D  J' c; l! d+ E
ns_marquee.left=marqueewidth+8: j8 o5 _/ B; v& m. X
}. `) r( F0 z3 {: z
}" b# M# O) p1 }9 E' j

7 _" C6 X. I' Lif (iedom||document.layers){
9 @/ W  D5 g$ Kwith (document){3 h+ z& @- U' g% @+ r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- C# v. N+ j2 U, P
if (iedom){1 a" X9 Q. @4 E: W" L; F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) h3 }5 l& |# @% \6 S( v  iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' |9 x9 h7 D1 I, a4 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 @( z7 W' {) v" h  Y" lwrite('</div>')3 {5 P& z  K3 }; z  j  [7 m/ v; A
}
: A7 y1 V1 v" @4 L# E# zelse if (document.layers){
7 p8 |; r: K, gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 ^) `7 h+ @+ i# i8 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- J; \8 h) o$ A  J
write('</ilayer>')
. C8 o! p- Q( I3 {4 G( K}. K9 Q3 x8 i, @4 W  b
document.write('</td></table>')
9 W3 C& S4 V1 l. U0 c) R}
& Q, }* ^! s! w}$ O  I. G8 }% S5 }* K
</script>

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