返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. g, u  U& h2 [4 W( ]( Nvar marqueewidth=300
: `% T3 M4 o/ t; w# s( p, `5 |//高度
  M6 q+ M* P, o' p, _" ^var marqueeheight=25& m, _$ n  ^! ^3 R, g4 M
//速度(1-10)' f# l: ]- h6 w6 G
var marqueespeed=36 {  g3 {  R" L$ d6 }# {
//背景颜色: R6 F4 T& }* X4 Q8 s- X3 V' I/ Q
var marqueebgcolor="#FFFFFF"/ Y" J# e) c" y4 K; L5 n8 j
//是否能暂停 (0=no. 1=yes)?
9 A: w* s* r7 A. Zvar pauseit=12 k( F2 P& D- ]3 N) t) b# e1 a

* ^, r# w# h6 G4 t9 o//修改显示内容
" s- o) z: k7 }3 l; x3 J6 k  ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 t5 o  g4 S* b0 d: l6 g) D
8 o/ [& Y: k# M7 g' a3 b
2 T$ r7 [6 l9 m+ q2 `
////下面不需改变////////////
' f& ~4 m8 B! T* u  B( T9 r) m9 ]" Y9 @" e
var copyspeed=marqueespeed; L% g- ~% [4 _" u, R. G$ u
var pausespeed=(pauseit==0)? copyspeed: 04 q4 ?# K  g% ]8 v
var iedom=document.all||document.getElementById4 M5 a) {8 U  l: c+ g6 V1 _
if (iedom)+ `) f+ k+ p+ x5 U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 l& Q) O, O3 M$ jvar actualwidth=''
! K+ E: C. L, G  d( y7 I; vvar cross_marquee, ns_marquee7 M/ f  M$ a1 i
- H+ C6 Z0 q2 p1 }
function populate(){% Q& G8 \0 b/ L6 n2 o7 D2 J, ]
if (iedom){
0 u0 Q; d: @# n  w; w& [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 Z; R7 B5 t4 ^, S, V$ Hcross_marquee.style.left=marqueewidth+8. U' \8 z  n, e9 W
cross_marquee.innerHTML=marqueecontent
1 \, ?# a- h* ~$ N% ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; M, k0 r" d; f( P, q6 L}0 X) n; I8 ?9 L- u- [  P
else if (document.layers){
/ R5 r3 H5 Z  \2 r6 C3 m1 j3 E$ ~ns_marquee=document.ns_marquee.document.ns_marquee2
+ B7 Z7 E2 D  E9 @5 c* [* Bns_marquee.left=marqueewidth+8
+ \4 M/ J) R$ u! [' I  lns_marquee.document.write(marqueecontent)' t) \) W. W" {6 k4 Z! J
ns_marquee.document.close()
! `% U: w: E  i  Yactualwidth=ns_marquee.document.width( J9 `- f, K* P( [6 G/ B5 ^, U0 r
}7 x1 G+ x" X) O5 w; L" V! @7 \
lefttime=setInterval("scrollmarquee()",20)
5 X! f) [0 E; z- C}
& H& V8 m. o+ v  S. O4 g  ewindow.onload=populate$ F* h) I8 `$ x; C6 W# [* F2 X
% V! s9 C* l: _1 m; M' }
function scrollmarquee(){' ]( S9 K* ?/ `# F5 w! k9 L( l
if (iedom){
0 w& j2 f0 r7 I6 E3 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ ?9 |% F& S, Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 m( a. }, d* Z  {/ M5 a5 A
else8 C/ T' L* q9 E8 G' L& }2 O
cross_marquee.style.left=marqueewidth+8% t/ g' J( d4 f) ]- \3 y( t/ r

9 N* N0 L, x# j3 u) P}; L8 P$ \9 S. `3 e8 \
else if (document.layers){
4 i+ y  T4 J2 O+ C  e% y; ~' Xif (ns_marquee.left>(actualwidth*(-1)+8))
3 |+ v) ^* n- X3 i! j; Nns_marquee.left-=copyspeed
4 a/ b1 e1 D: Xelse
) c1 A7 w# f2 J7 [5 ens_marquee.left=marqueewidth+8
# e6 O( w$ J% J# n( [}
& d" J4 E% [# h! S& l0 e% u}
5 c* i/ r- M5 q6 }: t7 j0 i
9 S6 X3 R5 f: B+ Z9 `# e9 K! Tif (iedom||document.layers){
* i" F9 R, N$ S$ ^6 swith (document){0 l% `" j2 Z) X- t  m; f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 `* W7 f& t- G$ ^, s# ~& q( Wif (iedom){( {) l  q9 _" W" O4 c8 o/ e* S; ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  V' R5 _2 c: P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ {0 z6 R$ |2 p  m5 ^& J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 _$ }' U  }. m0 l; C4 c0 b
write('</div>')% r$ c+ ]$ _1 l8 t2 a; S$ w
}, L/ o0 J+ R( M- }0 Q$ L/ }
else if (document.layers){/ m; ?: E' C! g6 \" r2 v. T. z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' r; _- @$ r8 D; R" Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 J2 K( |% _. i
write('</ilayer>')
- x) E7 n" X3 U& S+ [}
( C1 k; n& [% X0 ]7 Z6 o5 ydocument.write('</td></table>')# N/ a0 X5 o) {/ I4 N3 J
}
6 j6 b- L1 Q8 k0 O! F  ~}
0 T& ~1 }& \, w$ J</script>

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