返回列表 发帖

网页之跑马灯文字特效

//修改宽度* X4 s; M) d3 f2 `
var marqueewidth=300  q+ H" ~$ x0 t) N
//高度
; e* t+ s0 i7 j: C! F  h' \& Lvar marqueeheight=25" E( V4 p- G3 x. J: t
//速度(1-10), l5 u+ E. J1 E0 j9 H8 E% T
var marqueespeed=3' J, z2 E, W; K. }5 p# T
//背景颜色
) s8 \0 `6 }1 a, H3 }9 a0 h6 C8 cvar marqueebgcolor="#FFFFFF"- U; q/ |5 |# k
//是否能暂停 (0=no. 1=yes)?
, r; I5 A: k. J% u% D9 K' `4 v/ wvar pauseit=1
( x! g. N; o! C3 l) Y' o  q, a8 r, b; x# @2 m% ]
//修改显示内容4 }, j" u/ Q9 c3 w  E! I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 v3 v! v( x, l2 w1 @- s2 M7 N. P6 U: ^! l3 \
. n6 {- C: t- [- o. l5 e
////下面不需改变////////////
. q) X4 Q* r% [6 H1 ?$ r5 z8 V- Z; {  {2 P
var copyspeed=marqueespeed
, x% {- _, \6 O) P  l, ?  V4 R' Svar pausespeed=(pauseit==0)? copyspeed: 0
, g8 c0 C8 B9 V% ^  m0 evar iedom=document.all||document.getElementById$ b9 ~9 W1 A4 J& M6 n1 f% G
if (iedom)! G) E% j' V' B5 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 z8 \( T, f' E) K6 Q
var actualwidth=''& m* c  L% O! b- ^, Y
var cross_marquee, ns_marquee) M. F- ^% l) \9 O& ]& g
0 J/ \2 Q+ Z0 C# Z# o0 A
function populate(){1 `0 c  ?4 ?& @! U
if (iedom){
) _1 \, k8 R# R: r" \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# J8 P) w: }3 l& L
cross_marquee.style.left=marqueewidth+8
4 _0 v+ Z5 }4 o; w8 d  q" across_marquee.innerHTML=marqueecontent
$ [* ?" ~: h- A( e  k# H) n6 vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  d9 Q% `  C' F8 G8 i
}7 N+ _. V6 t2 n( V
else if (document.layers){# I, r8 w- K4 ]# B/ C
ns_marquee=document.ns_marquee.document.ns_marquee2
+ p5 ^! |- n+ d3 z$ _/ n3 x0 i, Hns_marquee.left=marqueewidth+84 u5 a9 d* B2 r! C5 b( w; S
ns_marquee.document.write(marqueecontent)
5 R5 [! Z. p8 sns_marquee.document.close()
( Y) q8 ^* o, yactualwidth=ns_marquee.document.width6 i$ ]1 V. `9 s- t, q( ?
}
) p+ Y9 N: o1 e$ U1 [5 R6 N: nlefttime=setInterval("scrollmarquee()",20); `$ u6 |% h; h! A4 Q+ \% g$ @; i
}2 x+ U1 J7 L- S! R" z, x9 p* {8 ]
window.onload=populate$ F7 `/ E% M. e- {  Q5 B" z
' H8 d2 y% k; P6 f
function scrollmarquee(){, w% o& b1 D  x# o. Q+ ]
if (iedom){5 L% \- }3 C* |/ w% Z& c0 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; g4 c; r+ N3 ?) ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, Q1 S5 P! r  ^/ f, P# I& eelse# K7 Y7 D7 p. c: I5 L% |+ Y; f
cross_marquee.style.left=marqueewidth+85 l( V' H) Y% ]* q) F& v
4 ?( U1 t) A1 U# H" f: a9 Q5 M
}1 L+ X6 G: q3 h6 i5 O
else if (document.layers){
0 ?9 i5 n+ N' Nif (ns_marquee.left>(actualwidth*(-1)+8))
5 t/ J3 S" A% z6 @8 lns_marquee.left-=copyspeed
( A5 R: m: O7 Y+ E) Uelse
( f7 Z- B4 b( y- Q' j% D  cns_marquee.left=marqueewidth+8
9 F2 i7 M, F3 O* Z! f, y7 y}$ S  O7 [1 P. z: ]
}
7 _2 B( W* ]* F- A7 @% Z/ l
. f( J1 B; ^$ X' A; Lif (iedom||document.layers){
" e5 ]9 {4 L# \with (document){  e$ a2 \7 {# x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( \( }2 i! h5 X7 {
if (iedom){
8 B9 V  f9 c' q" I5 ]6 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* W6 t# z/ P# C8 p: O$ ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) p% R6 {1 W; p4 B* _4 v4 j- ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  M, \( V2 d0 Iwrite('</div>')
+ u6 x; h* R3 v! h/ A}
4 z1 G' ^- A$ V  aelse if (document.layers){
5 V, W; @8 y8 F5 S" }3 \( vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 {" a2 S0 B2 M% O# ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# T' G% p1 n2 s* }
write('</ilayer>')& u1 ^4 w6 @2 `& I
}2 S+ {1 o& _! \. a: ~2 U) S
document.write('</td></table>'); g+ Q* `% _$ O  x8 q$ i
}' \/ T9 ]: w# I- n. N7 j1 J
}
' a: ~1 H- v1 g% T. Y7 F</script>

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