返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ }' N! n* N) q) K5 l( s, K: Gvar marqueewidth=3008 `! D/ i, g) l
//高度
7 P; u5 J8 [3 o& l. d4 B, |var marqueeheight=25$ A' c" w, b$ B7 x3 s+ Q/ R  f9 I6 J
//速度(1-10)9 O/ t( V  w# i, N& a8 R( f
var marqueespeed=3( x1 G; A' d4 F* q8 }
//背景颜色, T0 i% L- Q/ A  [
var marqueebgcolor="#FFFFFF") p5 a! J3 m4 I' @; Z% Z8 L
//是否能暂停 (0=no. 1=yes)?
, D$ A* A# V, L& P  U- Nvar pauseit=15 `8 C" N& G& I, ]2 ~

! N8 D; Q2 C$ v0 W9 g//修改显示内容3 a8 ?7 w5 k+ T( L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' ~6 `: x' V2 B( K
' U: h+ j+ f; S1 l! f

! M( p( t( \# Q/ V; w4 _; Y////下面不需改变////////////
  B3 f6 {- m3 D. {9 Q5 U+ p2 `, L" M$ \" f
var copyspeed=marqueespeed
/ q" d0 B; a+ t" ~4 s; P) T1 c  Qvar pausespeed=(pauseit==0)? copyspeed: 0, k' ^! v  P( R
var iedom=document.all||document.getElementById
. A+ b) A( h6 ^) O! v  E0 Jif (iedom)& S& Z8 I) a+ Q9 r8 Y% n  o% U  q+ d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 p5 t6 {0 y2 ?' j
var actualwidth=''- p# ~* _- J3 D" K  z& a
var cross_marquee, ns_marquee
- i, t; [' |% [8 T/ o3 {/ X0 s) c0 H. c
function populate(){
  ]2 o& |8 J$ J+ pif (iedom){
) n! H8 N6 }/ ]5 n" I5 _2 i6 Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* D5 O+ P' z9 h+ r# e- r/ D* D' \3 r
cross_marquee.style.left=marqueewidth+84 I) [7 I% \3 X
cross_marquee.innerHTML=marqueecontent3 a3 l3 C3 P9 Y: P5 X1 T* Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* I5 o  w  a1 ?8 O}
+ b  i" R1 x, W# \else if (document.layers){
. r; H* d6 F6 g4 K1 z) x% `ns_marquee=document.ns_marquee.document.ns_marquee2: f! I) [2 {9 U3 N0 Q
ns_marquee.left=marqueewidth+8' z7 O5 Z: F" `. \% n/ m
ns_marquee.document.write(marqueecontent)' z, ~4 j  M: p7 `
ns_marquee.document.close()0 @4 j0 \0 ~; _
actualwidth=ns_marquee.document.width; N+ `  I7 a3 ~& w* j  y4 Y4 P$ v0 h$ m
}' f) y1 _" R& }& }* n
lefttime=setInterval("scrollmarquee()",20)
* }& n+ t0 }# P+ }' u$ t  X}* J! u( B# a8 e/ M; L
window.onload=populate
+ R/ l( m- D( L7 w5 k0 v( `9 l
' |2 }* ?$ @0 x! k2 nfunction scrollmarquee(){+ J  L! L* [$ h, G8 f1 p. M1 s
if (iedom){
, l6 W& W( Q. q1 Z, lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* S9 X  Y4 t/ h+ O' w0 L8 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' D4 Q0 `" I+ F$ Kelse
" y$ U) V1 c" k7 zcross_marquee.style.left=marqueewidth+8
9 @, Y. J( }8 E3 p- K* a6 a
8 M3 G) S, U8 z}
. H) J: L' ?% W. h, P4 ]else if (document.layers){" `( U) D1 J8 }* i2 o3 g
if (ns_marquee.left>(actualwidth*(-1)+8))/ P6 s- E) q. T0 Q7 e
ns_marquee.left-=copyspeed4 Q$ \5 w5 C( }& G
else
6 M3 H+ Y5 f! Y4 U0 `# Yns_marquee.left=marqueewidth+8
0 D8 D# _  A8 v" d+ d2 t}# ?$ L* Y' ]# E" G
}, R8 {1 m2 X% F

0 ~( `$ u4 P9 tif (iedom||document.layers){" u$ A2 V# p- }
with (document){- y- m( c: Z) s0 \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( y- I6 f3 f3 D8 r& W& ~$ nif (iedom){
) G/ F+ ~$ L% A3 R% fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): |* U3 S$ S0 l* a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), H* Y7 u, \; e1 w: ?/ A# D3 T/ R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ A; q% U, @! t& a3 awrite('</div>')
4 R& ?. O7 M5 x2 S+ y  D3 C7 Q}0 X, ], \# r4 a1 ?& A
else if (document.layers){
+ [# f* |: O! p. a6 F2 Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  }( F/ ]. ?( L! G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- E# Y7 r/ O% u6 K$ V- h) f
write('</ilayer>'); n+ Y- z8 r2 ?" E# i; x* t( |
}( T1 ?4 b' r* V; o, a2 X
document.write('</td></table>')9 _$ {) O8 m( q  f5 H
}
/ v( x8 M2 V9 n2 b) b}
) u3 W6 F3 A- z</script>

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