返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 x3 X. e: W: Z, y7 C# o9 r  N
var marqueewidth=300
5 G* h7 K: i# O3 j0 o//高度
" C% E3 G2 r$ u2 C1 ?! `. Nvar marqueeheight=25" |6 L7 S9 k; |0 |# F
//速度(1-10)
" _9 T- v4 m* \1 vvar marqueespeed=39 m9 O  n5 X6 r" C  N# a
//背景颜色
9 X. ]( r+ T2 Gvar marqueebgcolor="#FFFFFF"- r4 V# z- F4 _% Q2 B; b
//是否能暂停 (0=no. 1=yes)?
; z' H8 g1 o3 i" j- }. X- H! E- [var pauseit=1, ~2 m( \% x5 Y- E) F

& A( }! N( |. R* A//修改显示内容& N7 H  o. ]# E( j3 A$ b4 i. M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ X" P5 Z- k+ A  N1 J# [  Y( u
( T! g0 s- ~0 B+ R  K
) q+ N  _7 w7 m1 \3 M6 e  x
////下面不需改变////////////
& L2 X# M8 N& F
% U7 _. ^' R: N! J% M) jvar copyspeed=marqueespeed2 {$ q5 g, {  C& y, _
var pausespeed=(pauseit==0)? copyspeed: 0
8 O& _. C6 K3 T# Q% x8 {9 \var iedom=document.all||document.getElementById
$ F$ c3 \- i" {) }if (iedom)
- o" V9 ~8 a* X5 u4 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. Z) n& a7 D, g, _% G/ H( E2 ^var actualwidth=''
) B: `1 j. Z! Nvar cross_marquee, ns_marquee5 v' f! T+ @( p& Q# r6 c) X
6 E/ m7 M! y9 I
function populate(){/ P4 l9 b/ ~- R/ g& u" ]
if (iedom){# |" P. d0 r$ p8 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; @9 s* c9 ^: N( q9 t% across_marquee.style.left=marqueewidth+82 ~9 A* I; S# L7 a8 z
cross_marquee.innerHTML=marqueecontent3 j. t- f' W) C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! @8 D+ F$ b9 j' z) Z- }
}( O: ?; X* a- H! x' F
else if (document.layers){3 t2 j7 c& b# u' E
ns_marquee=document.ns_marquee.document.ns_marquee2
6 }$ _! Z8 n+ G: W0 ~/ Mns_marquee.left=marqueewidth+86 ^; ~8 C  c" b0 B; o
ns_marquee.document.write(marqueecontent)* b  p% ~" A: {0 D( @, F9 z
ns_marquee.document.close()
% P$ N" s# Y  R# ~( Lactualwidth=ns_marquee.document.width3 X) g* G; K. a% b- k+ A
}
/ N4 w" p5 W2 a% r& k) xlefttime=setInterval("scrollmarquee()",20)
6 V2 l4 m! k1 n* E4 C) K}" H7 t: F( _0 _( D- R
window.onload=populate
2 w' k0 k, ~0 U2 m- S9 Y9 U. I/ f, i' a
function scrollmarquee(){
6 F8 }- v! ?) @! l3 ^' O( bif (iedom){6 E2 t7 \( \( y9 Z5 Y+ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* {" S  Y& J  K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 r& e8 _/ c6 r% n8 A. Delse
$ q0 U, M% l! @. B6 a* j3 F/ bcross_marquee.style.left=marqueewidth+8. v* H$ z( C0 [8 W
& g1 U/ Y% x$ A
}+ }/ @) y! O' e! ]4 z; U4 g
else if (document.layers){7 _! v) |- n  A% Z
if (ns_marquee.left>(actualwidth*(-1)+8))
" M0 w2 |  x  j- E+ L% w: A# `; qns_marquee.left-=copyspeed
3 }  _' V" J4 ~2 w) a, |else- M6 ^. s# `: B7 o4 i
ns_marquee.left=marqueewidth+8( e. S( V: K9 }4 m" X* V1 k1 ?
}$ t% A' j( k- Y1 r% k4 P8 B
}
9 e( O0 ?% H" B- W$ Z+ m& z
! p# h  L: V8 ^5 j; S/ k; r( b; n  H$ jif (iedom||document.layers){
+ F  y) J- U+ H) l7 Jwith (document){
! g7 o6 v; w5 @( o  s9 x. rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: I! `3 f/ {) [  oif (iedom){
( M  ~9 w; ?+ B9 y; H0 _9 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! P  \& n5 ^% _# Y" _3 F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 a* a) X' H0 M) t& xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 u( {+ A. W: _0 X
write('</div>')
  T- y1 O% ?& x2 ~1 q8 z: e}
0 j4 V! G" u6 T) @: w, I- a* Y+ q- qelse if (document.layers){
: V% q4 o% }0 N# B, e. Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! T  }7 B% }* r% W, i$ q' B7 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% d: f9 L0 B# h$ J1 {1 P) x% C6 V9 B) O
write('</ilayer>')
% t% ?, }: \8 s! z6 `' ?$ F* |: J}5 Q- g& K! Z; \
document.write('</td></table>')
. o1 f$ J8 ^# y7 h. E% a}% [+ T. m2 ?+ O1 k2 K5 Q
}; k8 a! {, }* w, T5 N) n7 J. J
</script>

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