获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( Y$ M' G4 @' y( ovar marqueewidth=300
% f. }% X4 M( K5 t//高度' @+ s" C- S# {% k+ i
var marqueeheight=25
% ?7 g' S  w8 \( `$ `//速度(1-10)
9 X, {- _4 R# Z' o+ l+ C/ s+ @var marqueespeed=3* A6 v2 P! A' |3 w  E) d
//背景颜色
5 R' f  j; r2 X% z# Avar marqueebgcolor="#FFFFFF"' ]0 Z; s6 S' f/ v8 {2 k& O9 {* x  @
//是否能暂停 (0=no. 1=yes)?
- n; P+ T3 `2 T8 v4 Bvar pauseit=1
9 g& ?0 N/ }0 U& V9 l- I. B  X+ y( C% z# q
//修改显示内容$ Z- @! B6 Q7 f5 {9 s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' T2 P4 H6 i+ i# p
6 c7 U4 E$ Y' c& J4 D! _5 l# ?
5 A' b. c2 [4 h( M, k4 z) N& a, B////下面不需改变////////////3 U: h. J7 j4 K- g( T# b9 X

% C, s% W; F: k+ ]. Jvar copyspeed=marqueespeed0 w! B9 D& [; X7 v
var pausespeed=(pauseit==0)? copyspeed: 0
. h7 {  B+ [0 dvar iedom=document.all||document.getElementById, t& K+ c; n7 x3 w$ y* B# c
if (iedom)
: ], d2 h0 i4 h1 A, i0 J! Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 {$ A# u- w5 L2 M+ t  ~- {! a" O! yvar actualwidth=''3 f1 D; Z0 Q( K  ?" M8 [2 P
var cross_marquee, ns_marquee2 y- |  T1 h/ ?5 c7 G- o4 r6 N
( f3 P) {7 t6 [2 e2 y0 Q2 L7 \8 e% h
function populate(){! s4 m. ]6 q  V# q1 d
if (iedom){
2 T/ R3 [8 b, e, Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 b' U1 r3 Z) y% c' v2 h5 j5 E
cross_marquee.style.left=marqueewidth+8
& ~2 G6 M" ]) t; E) A0 R6 V) Zcross_marquee.innerHTML=marqueecontent
$ f: V4 f) O+ {: z- P$ C& ~# c9 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ |  V, E8 b' l& T0 x4 b6 l}9 a% b, f* d) t" o2 A
else if (document.layers){9 b( h1 b. O" ?  x" ^& ^( E+ N
ns_marquee=document.ns_marquee.document.ns_marquee2
+ k1 B. _% \! T2 Q( wns_marquee.left=marqueewidth+8
/ Y: \5 K, A  [$ E5 B3 t& ^2 |ns_marquee.document.write(marqueecontent)
0 \* f% x$ W7 D! }3 S% Dns_marquee.document.close()( [3 R. {5 ?( ~, _. I1 ?
actualwidth=ns_marquee.document.width
! _9 [/ ^( s4 d' G0 b' R( ^}. _- G7 U) ^/ K( q; w
lefttime=setInterval("scrollmarquee()",20)( a* G0 F) Q! I( h9 E* U
}
$ a3 |" x+ K6 v1 dwindow.onload=populate% [2 A& N: W0 a" b, F+ ~5 B

! o. q3 ?  O: w  A( ^2 zfunction scrollmarquee(){% e+ f/ F: c4 f- Q4 M' P
if (iedom){+ B  z  y! X0 j* ~6 ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 {# a. {) d' Y5 s0 B2 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 D8 L8 k  _+ |2 n( \' k  j
else
- y4 ^; W7 E' q( l0 I5 b& Ucross_marquee.style.left=marqueewidth+8) P) D8 \/ R. n( x

# o, k8 T* }: l" D0 l}
! F/ g+ K8 v' O, `# n/ I4 g" K' @  Eelse if (document.layers){
% T! l. d1 W. n* ~: p* Aif (ns_marquee.left>(actualwidth*(-1)+8))
1 w8 l# q: S, v+ z) Tns_marquee.left-=copyspeed
5 ]8 v4 h1 X( \2 h9 W% lelse9 v, e* |. A! R! Z( @
ns_marquee.left=marqueewidth+8
, x; G- m* f$ _# G% O) a}
1 S# X7 m0 o1 Z( ?2 G}
1 f- q- g# `) j1 D: U- A: @% t
' K4 h2 n- F2 I$ Gif (iedom||document.layers){
0 C' W! X7 P' w# Owith (document){
' i$ N6 y, j% c  N! n6 q# u3 _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 ?' W/ Y/ v7 K1 Yif (iedom){- R: N% b8 q& h+ W/ n$ F) R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! j$ Z0 o6 j$ D" @; I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 i  `( l' ~! Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 @7 C) S# [, ?/ G8 x6 J
write('</div>')
6 Q7 L/ w* Y- o( N  X}
# B5 d5 Z0 h* Belse if (document.layers){) v( ^- t3 t" @4 x, ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- y% r1 _9 F( N" P$ \' hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 g5 X0 K- K) J9 k! j6 Nwrite('</ilayer>')
+ |, l6 ^3 P. V% i! B" a8 \+ \}
8 K: Z6 ?$ M8 R. [# Ldocument.write('</td></table>')' B# c7 E& Q% e) i0 m2 Q+ {
}/ P$ j( f6 h! i/ l8 g9 Z% @
}# n& u2 X$ \! i! y& B8 i
</script>

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