返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ W! F2 k4 o8 V8 lvar marqueewidth=300+ H" V% c0 q9 G  b# n: u
//高度
$ S9 D5 f# _& W( l/ Yvar marqueeheight=25/ @3 Q' y& n: w' R' H7 P
//速度(1-10)6 t3 P8 r5 a1 n0 M
var marqueespeed=3
6 @% A  |, p9 C4 T& G; B1 J7 E//背景颜色! t# w& v* O- {
var marqueebgcolor="#FFFFFF"0 F- f# T5 Q/ g* \7 J6 Q* ]' X# P% T
//是否能暂停 (0=no. 1=yes)?
7 t( v+ M7 _% V* Avar pauseit=1
' y7 h; q/ Z. d4 t" A, ]: S1 ?  h
//修改显示内容
4 m& h8 e2 C0 j, g8 {9 g9 jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': i0 K4 d# Q. W8 h. K

8 O/ o( d/ y9 F9 q8 R2 c, r+ G) |0 q' e" v; R0 F" j
////下面不需改变////////////) M$ D( {3 [9 l, e* W

4 ]# d8 Z9 |  ]  A  svar copyspeed=marqueespeed
* b4 v! L* G$ r8 gvar pausespeed=(pauseit==0)? copyspeed: 0
, [5 z4 j: l9 R/ V) l- c9 Tvar iedom=document.all||document.getElementById
/ T1 g+ n: g  hif (iedom)
3 p0 \4 c8 m- s9 H' odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); D/ |* B9 K& {4 Y
var actualwidth=''
' @7 s& }4 U* a! T1 P$ wvar cross_marquee, ns_marquee
6 p; |$ }1 \# Q9 M* c
  M7 U, q3 N, N; \function populate(){
) _. `  x$ I2 I) o" ]2 O; U" Bif (iedom){* W/ I, }3 f& D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ M: u# v( j. A. X* o
cross_marquee.style.left=marqueewidth+87 W" _% y' q% f
cross_marquee.innerHTML=marqueecontent
/ ]  v$ q- [( G# E+ B+ c: Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, j9 E$ V1 |. ~2 Q6 i
}
* J& e  F( Q4 L. Z/ m2 R! D, h& Nelse if (document.layers){2 O/ A+ |3 G/ \" ]/ W* f
ns_marquee=document.ns_marquee.document.ns_marquee2
3 @( N% p# z6 uns_marquee.left=marqueewidth+88 l! j3 e5 q+ i+ C7 E
ns_marquee.document.write(marqueecontent)
2 w; ~; W# X6 R' d: |, sns_marquee.document.close()
$ n/ @! z8 Q$ L" r4 Sactualwidth=ns_marquee.document.width
* Z9 J" U  A: ?+ X9 }; A% ^}
. I" ~0 s; |! ^' hlefttime=setInterval("scrollmarquee()",20)0 v8 _+ |) I# e% s/ T& e6 i
}" E- h$ t2 p9 y0 u9 l% i6 w6 p4 K
window.onload=populate1 K4 Z2 T4 I) N: p- m# n" F

" I/ s; C' z! W. ofunction scrollmarquee(){6 _0 e- G7 i" J7 G
if (iedom){8 _  ?; B& _4 j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ n8 t' ^. V! z' r+ ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) |  g  q) }2 J6 y: uelse
8 U4 Z  h5 |. F! |6 Y  y4 E% M8 scross_marquee.style.left=marqueewidth+8
. {( L! A& |* E) _$ x
4 X/ Z. z- A3 c4 [" M}) f& o  m* C7 R/ q# L
else if (document.layers){& w- \0 F8 n' `9 x
if (ns_marquee.left>(actualwidth*(-1)+8))! D1 a9 C$ \9 J! j, f6 O
ns_marquee.left-=copyspeed
; j: G: _5 f7 x8 e# A9 yelse
1 _1 n( V0 S' E) |. C2 T2 fns_marquee.left=marqueewidth+87 v$ v' C% z5 m% p4 H
}
3 g/ a! W! f" H7 J, Z}
0 X+ y6 c$ Q- Q" B, v  l8 k7 ^6 J* D) Z* z: S  Y* [
if (iedom||document.layers){4 j% `7 H! }  q3 ?+ o" @
with (document){4 j" p; x1 A- E9 z' ~3 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 y1 X0 R  P) t. x6 x1 f4 s& D: i
if (iedom){
# j7 J+ b" E; @' }7 m" Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 t% ~& P/ M  Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; ?' m2 I7 a2 U/ D, Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' h4 j( f0 W5 B5 x! t$ jwrite('</div>')! n6 @/ x0 u. s9 I2 d* T
}8 t+ \7 l% W1 F
else if (document.layers){
' ^; \, Y( k5 R( a0 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& _: g  z. e- z- k+ S' w* I7 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; _  i$ `/ y7 ]7 S2 z/ G" wwrite('</ilayer>')7 [4 r6 _+ d6 u" p
}% a$ Y" L# Y& I) d! O6 E9 N7 R
document.write('</td></table>')
; p% _* K. }1 X' q4 L* z4 G}3 r) A. w! v  j6 ]4 A3 g
}/ \+ [6 p3 j1 `' O
</script>

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