获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- n) [: j, }8 H+ h. Rvar marqueewidth=300  X5 T! y3 o! y, j
//高度$ M2 u- m5 @) P+ o4 o* N
var marqueeheight=25
* R& A. C8 _- ]6 H) ]1 A# E+ E//速度(1-10)
2 B0 ]4 _8 M7 I4 s# Lvar marqueespeed=34 g4 T" T/ _0 m: Y: y) r
//背景颜色$ B) z) O8 M: e* \, p
var marqueebgcolor="#FFFFFF"7 j/ E! j) `& E3 P1 S
//是否能暂停 (0=no. 1=yes)?: t* J! I1 T; O% v" w& v$ n" U
var pauseit=1
! v- k) M% W$ u  |7 @6 a( V" i
& \% `5 ^% }' L! W1 ^  G2 a8 x/ H5 ]//修改显示内容
' d. v) Y; y5 v) Q( {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ B! j6 W7 ]' O. p5 {9 X# w+ l
( C; R  x4 U% \  u( ~
////下面不需改变////////////
1 [9 i- \& {; r8 }" V* a' R* x/ g$ C
var copyspeed=marqueespeed
. h$ I( u8 o6 d( X: L# z/ F6 `4 bvar pausespeed=(pauseit==0)? copyspeed: 0
( ~, i, S& q  C* n6 L! M9 k1 t7 ~var iedom=document.all||document.getElementById, O$ J3 Z' _) o$ ]
if (iedom)
; u% L- Q' t! ]1 l2 ~0 X7 Q( q# V6 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 `2 n7 @+ C$ Z, O4 T
var actualwidth=''
9 Z) q9 G" O, Yvar cross_marquee, ns_marquee* g/ ^/ K$ o5 d

6 Y* x$ u: m  i) Q' F$ pfunction populate(){* D  `" o; S* B
if (iedom){3 t( G0 P3 q* J1 k5 H6 t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% }& g& c; z* F9 x0 ^+ ^( b
cross_marquee.style.left=marqueewidth+8
, D+ W" C) \1 {' x, _cross_marquee.innerHTML=marqueecontent
' N* F8 [' ^' n# Z( J& D9 I' y* \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  N1 C9 K$ g( }0 z$ ]2 A
}
$ V3 S# m. Q1 Eelse if (document.layers){* x6 Z& r8 U  A" n# s
ns_marquee=document.ns_marquee.document.ns_marquee2
! M+ L! R" n& G9 ~4 k2 Cns_marquee.left=marqueewidth+8& D+ n9 `& m) [2 v5 ^8 x
ns_marquee.document.write(marqueecontent)  ^, ]+ B8 G1 E# g! {/ V" Q$ L: n
ns_marquee.document.close()2 C8 V$ |+ Z7 W
actualwidth=ns_marquee.document.width
* Z" i, T3 [. w, o}
3 h( J0 {& Z) h2 l- Nlefttime=setInterval("scrollmarquee()",20); |1 F/ p( `: M$ w& O. B' A
}3 R' W. }' K3 d: c# F9 k, K% G! x0 [
window.onload=populate9 n8 v* _+ v  N/ t3 _
4 S5 x0 u0 [7 Q1 T* s  Q4 r+ d7 ~
function scrollmarquee(){, U. ?5 @0 M: s* }2 d
if (iedom){
2 @% I9 H2 B6 K: j5 j9 j; G3 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 g& X# o6 ]/ B$ c+ N7 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 H- C% {5 n: B* W7 P% e# ]else
4 ^: u' O! B# D3 |! zcross_marquee.style.left=marqueewidth+8, E' p& @2 ?8 e7 R

# R  q  _8 l+ i" n6 j% ^}' I) T' J% R+ F5 x* |
else if (document.layers){
9 b( j; \& E4 A, ]if (ns_marquee.left>(actualwidth*(-1)+8))
! h  t4 P- _0 P1 ens_marquee.left-=copyspeed3 j; ^% D: ~5 R3 v1 x% \5 i( z+ K
else- M/ z2 l1 q' o  ^/ p
ns_marquee.left=marqueewidth+8
/ r2 P3 K5 a$ ^7 |' Y, g}
4 W( ?1 a0 I$ h}3 G% F1 i7 V  C4 w3 C8 @: ]+ y# y

$ n8 [: _% w& x+ x$ g! Xif (iedom||document.layers){4 Z3 Z* W- b/ d" V7 z
with (document){" G, h, `% Q3 c% p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. p6 s1 K* I) V/ v4 K5 Y+ Qif (iedom){
" R9 A6 Q$ Y( B( uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 A6 C3 l/ q  ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ^" j/ Z8 r) D5 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- F! q- J+ S) a+ E# L; x8 g8 J
write('</div>')
/ G2 W& [1 m& Y( x% C, ]5 I}/ v* F! m6 o" P7 o+ ]) W6 Z$ u
else if (document.layers){
5 g/ d, [+ j3 n5 W# Z) kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& X  Q0 W% H4 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) N/ D0 N2 V' c/ R9 g0 Iwrite('</ilayer>'). Y2 i5 d: \, h, ]3 [1 W
}
$ h; |+ {2 e7 L9 k) z0 g1 Ddocument.write('</td></table>')1 [1 t/ M0 L' `8 U1 s
}4 Q2 Y0 T, `% Q' f' r& Z, i! w' ~7 D( a/ z
}! [, ~+ |8 d; d/ \
</script>

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