返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 L. G, Z6 t' C- S5 i
var marqueewidth=300
4 k' |. C5 Z3 V( G5 I6 W4 V9 d! e7 S1 ^//高度
; {: M5 |- V) l+ M* Cvar marqueeheight=252 j2 g/ k+ u* O0 T- ?
//速度(1-10)
) \' p# c* n; N5 @$ s* Rvar marqueespeed=3* z$ }, f' i  D7 W3 v5 R) v+ Z
//背景颜色% ^8 `( r- [  v2 m* u
var marqueebgcolor="#FFFFFF"# [" K2 h9 Y7 C' R/ P
//是否能暂停 (0=no. 1=yes)?, L, p2 a* e  m8 u& _
var pauseit=1" J% a, E3 T& t" h8 S4 V* Z/ e* ^. w" h

1 `/ y5 ?* i! z8 V$ W+ v; S# g//修改显示内容
; v+ U/ C4 C7 b3 p4 L) l2 d2 kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- b  B  N# n+ T

# V: ?4 @4 A& h. J6 F  Z$ {' _
. \; @+ i7 e6 I////下面不需改变////////////' {7 M: l: M2 c- x) q& B$ N/ V

5 C0 U( _' F: W; A4 q9 j6 |var copyspeed=marqueespeed
% E7 a  X. Q! }7 ]6 ^1 N( c' Bvar pausespeed=(pauseit==0)? copyspeed: 0
; _0 ]. j+ m! d! E5 b+ `var iedom=document.all||document.getElementById
: T2 v* f- S6 [4 q3 @1 Xif (iedom), k) P# |6 J/ @1 {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 [$ l( c/ F7 H9 ?. c# Xvar actualwidth=''0 E1 N, x  O8 b& B  g* o
var cross_marquee, ns_marquee9 N, ]$ I8 {2 F# z9 B9 H

4 f5 r: l7 b9 O& @1 C* Jfunction populate(){9 j6 t$ G$ K) S+ @1 Z  T: m
if (iedom){, X6 {& Z) J  i8 S- W3 L1 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* z2 d5 y! o4 N% y* J9 R* Z& k- z
cross_marquee.style.left=marqueewidth+80 H9 v/ l' o3 x9 W
cross_marquee.innerHTML=marqueecontent
- O8 F5 H8 t# ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. z# W3 L/ v; v9 A0 G# w  n7 q' Z9 L
}  P8 [; D0 V8 b! `
else if (document.layers){0 Y3 C) U% @/ _. g
ns_marquee=document.ns_marquee.document.ns_marquee2! K+ j2 |. J* H& |6 I, V
ns_marquee.left=marqueewidth+8
' R( }9 z& n" _1 T6 Cns_marquee.document.write(marqueecontent)
! P5 N! e* C1 t0 J% Tns_marquee.document.close()8 m/ @4 i: ^& V3 g1 x5 z
actualwidth=ns_marquee.document.width& x5 ]7 i- Q5 w: O1 Z% \# Z8 _5 _
}
5 a/ {' c) U1 C" C2 a4 ^! _lefttime=setInterval("scrollmarquee()",20)0 j. m8 O% o: O; ]1 m$ c- |' O
}
3 `- w  e/ }+ \2 Y$ y  ~& wwindow.onload=populate
: _0 U1 W+ k5 X4 S
, F% w8 O8 @4 F* Z' Ifunction scrollmarquee(){
: K5 J2 \: O3 z. Q3 Mif (iedom){  q) [2 K2 f$ \0 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ O- V& g! c% e5 ?6 ^- m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) |9 W8 Z  w% ~; g. f. Pelse
1 \) j: ^- ]) _) y* p. Ucross_marquee.style.left=marqueewidth+8
9 n2 e' x) a+ H( v& T6 l% {1 g8 z1 y+ X& G0 S1 s
}
: A3 n+ q1 I" |& H! |4 relse if (document.layers){! w! [" H# F/ ~: t6 S2 b! P+ M
if (ns_marquee.left>(actualwidth*(-1)+8))
$ Y+ \! \8 e$ u  T+ U/ P) xns_marquee.left-=copyspeed* s  P" `( |2 X
else
9 t/ T, f, H) q8 ?! f9 Ons_marquee.left=marqueewidth+8
( q* J0 W  K; a4 q! _}4 q( F% K- c# o/ K8 x5 _
}) Z) m2 D, I: `/ M) W

" Q& W! Y( C& Z4 T& S9 c/ @if (iedom||document.layers){4 Q% G9 h2 N* x4 W. S  O1 f
with (document){
' ], O6 s* l+ D- K* ~1 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). V. B/ v. {- N/ n
if (iedom){
' ]! V* `7 P8 i: Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 T1 k2 f, f4 _0 I' D3 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): [2 p( q- v1 b( y7 d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 I( @! b6 b2 T& D# Ewrite('</div>')
/ y0 }' y" A" T5 J+ e: f4 z}/ h& ?; J8 ?5 y  D- \% `3 a
else if (document.layers){
# F" _; a( u" T) Y9 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 f3 P4 S( K; P# ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( I9 Z! ~* f# s+ {0 m8 G
write('</ilayer>')
9 |' \1 j0 Z' g" G6 ~4 `) P}2 d, ?% O4 K  N# U0 L
document.write('</td></table>')
9 P) J) }- L/ q8 n}3 m4 \& @9 t2 Q
}
( v! X, I' H7 m8 h+ d* f, L1 W</script>

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