返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 x8 w: i. q2 Z. y* `+ V8 Jvar marqueewidth=300
6 ]2 M' u3 f! c# c//高度
' ?9 R! }; q: mvar marqueeheight=25
- [$ _3 s1 Q: g//速度(1-10)
2 E! o% U  S: r# q( o  O" f9 Z/ O$ lvar marqueespeed=3
5 @# E# p6 R8 V6 O. n$ O//背景颜色
( S! r' n4 j! s+ K! F/ Wvar marqueebgcolor="#FFFFFF"/ ?7 @/ o4 G, z/ O% w
//是否能暂停 (0=no. 1=yes)?
& ~' V  l4 V3 v. [4 R% Ivar pauseit=10 U$ Z7 Y6 E' F4 L+ t! m

, o4 d- l' C  q3 x8 X. `8 W//修改显示内容
, L+ G3 ]9 [1 K7 cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ r* V# O$ d) l" R7 [7 w5 }

% g  j( f+ u9 K9 f. r& _2 Y. `0 G0 d. q; w0 e9 ]$ ?
////下面不需改变////////////
* L" ~- {% |# r+ ]. K  {: |8 T2 n
! H  {' C0 E) ~% ?4 U  Dvar copyspeed=marqueespeed
; K5 \. B$ S5 M% S3 k  n& nvar pausespeed=(pauseit==0)? copyspeed: 0
! k  N( o2 t( u$ Nvar iedom=document.all||document.getElementById% }+ _% F+ F2 U
if (iedom)% @1 c2 Q8 e5 i  v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 \2 [- V& I/ w' o* q* kvar actualwidth=''
6 O& \4 \( C- o4 f( A& Y8 pvar cross_marquee, ns_marquee* ^; M7 F8 I+ U! _/ |
) z' P$ o$ ^% R9 E; O0 S2 |# ?
function populate(){0 d  G9 J; s7 i1 q! v! u
if (iedom){
" u  m0 `' t$ W& g/ G8 c/ |( pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; b; s+ Z5 f' Z6 \# J3 x7 fcross_marquee.style.left=marqueewidth+8
% C9 {2 h7 P, T, [# j3 Fcross_marquee.innerHTML=marqueecontent9 n8 u6 {6 V+ G% B& q$ }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  t5 Z9 ^: @3 M( |! b}
& \' U" O8 O" }0 T) Eelse if (document.layers){$ c) y9 M- G4 M4 m. h* r
ns_marquee=document.ns_marquee.document.ns_marquee2
; F% d& H! S/ ]: H3 ?: B5 Yns_marquee.left=marqueewidth+8
7 S1 M6 h' R/ P9 r4 _. \' sns_marquee.document.write(marqueecontent): J* O8 e" `, Z8 Y) s/ _
ns_marquee.document.close(). j0 Y/ z' F; V% w+ o. x
actualwidth=ns_marquee.document.width
" v  B: J# \- E3 _# n7 T% d% G% h}3 t* j0 u" Y4 j
lefttime=setInterval("scrollmarquee()",20)
2 @: b& L% n" K8 t}
+ C$ {! R6 l# @" ?( k  |5 fwindow.onload=populate
5 n, i" h6 l1 A/ x% s. M
2 E* n; c& |" A2 x. W0 pfunction scrollmarquee(){+ c6 J  B5 G5 X
if (iedom){
' i3 Y- e: @  m! p/ j) A& ~5 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ @& b. W' q" n% G( M9 A8 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& r  |3 X* K4 d
else
! G! {* T% d# N) P) Xcross_marquee.style.left=marqueewidth+8
4 _/ H- y3 P. B7 I5 D" J0 K+ W0 E, I5 a
}
" r. l8 [  D( x1 h3 Aelse if (document.layers){
4 K, e- @7 _  B" b  Aif (ns_marquee.left>(actualwidth*(-1)+8))
) }; a+ w% ?) b# cns_marquee.left-=copyspeed
) [( d' ], Q( |else4 y" b6 |& w+ g  Z! R
ns_marquee.left=marqueewidth+8
( [; N" @3 T7 e7 ]# W, A% o* Z8 \}
) J7 L: z7 [( E}
) ^2 j+ T/ ?9 ?5 Q& Z
8 |/ Z( E3 _' W" Pif (iedom||document.layers){
! |  J* `3 y) a# Q8 Q( gwith (document){7 e8 z% J0 U4 s9 J' V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) J6 ^2 p8 U; v4 G
if (iedom){+ C, o6 M; O! o: f1 J' Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ N- K0 E0 M: r# Y# h& Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 P- G. I& ], Y& y9 ^5 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ L" O$ O% L- g+ K: d# F2 `+ k
write('</div>')
# ^; j' c7 i2 c/ s# @6 L7 r4 g9 t}
7 A, N# U3 J# J1 H7 x" ~else if (document.layers){+ T# Z. }; j# Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* G# b- O3 w, p# O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- b  b% h2 {6 U# b
write('</ilayer>')
6 R  h5 ?, c0 Y( z3 w/ q$ {: {}9 l' X2 G* G, m
document.write('</td></table>')! O. a; [2 h  {/ n' j) [- W% a
}9 e6 M5 s5 b! I/ N
}% v. w8 ]2 E; ^) r) H2 p3 }9 N1 x
</script>

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