返回列表 发帖

网页之跑马灯文字特效

//修改宽度! j7 f( o# K5 ?9 C- J4 z
var marqueewidth=300
( r5 T: D/ V. s% V//高度6 R3 Q* H& f4 |' j0 B7 D$ d
var marqueeheight=25
3 p0 ^) B. H. T: g' D1 O) d//速度(1-10)
- n7 [- u3 U' M# m& }var marqueespeed=3  |0 w3 r8 x; I+ d3 e; e
//背景颜色7 _+ i9 R7 V) y$ H  l& G% t  G
var marqueebgcolor="#FFFFFF"
& i( N: A. _/ N//是否能暂停 (0=no. 1=yes)?9 \7 M9 x- Y8 D' w& k; n
var pauseit=12 M/ [7 `) C# a

" O. Y# b- r, X! h6 y: F( p//修改显示内容2 y" h$ [3 E0 v) m0 E" y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  x9 E. G; ?: b
7 ?8 L' p# M9 s- B8 f
% x, x9 J) p0 Y3 e+ |7 T
////下面不需改变////////////+ g2 A% d- n7 H* M% N

8 @3 P9 u8 K. j$ C4 ^5 I+ V) ^var copyspeed=marqueespeed! n) k+ a, P6 V
var pausespeed=(pauseit==0)? copyspeed: 0
! \+ v3 _  h1 e7 Zvar iedom=document.all||document.getElementById
% G3 T* B/ k% ]if (iedom)
/ a' x( Q( J. h  S/ u1 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ ?5 P  X- o7 @9 y. A& N9 r
var actualwidth=''
  x- n& K$ q1 Yvar cross_marquee, ns_marquee3 G0 o/ u% x& i; [& J

! Q7 S9 r' }9 |function populate(){3 U  w8 ^. U- S. I9 S) `6 ]3 f: B$ G
if (iedom){
$ {1 I7 ]' t* m! c& a  s$ @9 Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 A* P: _5 E1 V0 Q8 |( U
cross_marquee.style.left=marqueewidth+8
. y" v/ Q, v6 S/ X# Rcross_marquee.innerHTML=marqueecontent
. _0 `% v& s0 M. B) W0 ~# a5 ~$ Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ y& l  \( W* B! W7 f' ]}, |( a4 C' ^7 [- e$ q
else if (document.layers){7 v1 g$ I5 Y+ o! {$ c
ns_marquee=document.ns_marquee.document.ns_marquee2- B" E3 t  u7 @" v8 M
ns_marquee.left=marqueewidth+8
4 R9 y& F9 g3 B- k: ?ns_marquee.document.write(marqueecontent)- j$ Z+ y# R6 S  B
ns_marquee.document.close()
- I( n, k9 m9 mactualwidth=ns_marquee.document.width7 |: \: V$ O' G  }& B! Q
}
! h& y& @4 M. T: clefttime=setInterval("scrollmarquee()",20)- b( |  Y' S' M8 ]$ X" Q5 a$ V
}
9 F: x9 v; ?4 q  a! U# S' uwindow.onload=populate& Y* u% ^) g* a. v* k
2 y9 d3 f( m& z
function scrollmarquee(){
: i& g& L5 q* w; C9 Fif (iedom){
& `" ?1 p5 H$ P5 |" p: L( Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 L/ R6 b: B. }+ D+ @3 b2 S. R% m  }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 c4 |; K+ O  m$ O
else! C& H# l6 i$ |, R
cross_marquee.style.left=marqueewidth+8
6 ]8 Y' V: W' ]# M% [
& B: X9 F8 h3 s" K* _! ^7 L}  }8 v& f2 r0 \- }* j/ Y& u
else if (document.layers){
: T9 ^8 I% U6 y" T; |: Sif (ns_marquee.left>(actualwidth*(-1)+8))
# q: O7 b& q6 _" u; u) b2 Fns_marquee.left-=copyspeed
: w& x# H* y& m7 H9 ]else( _- `+ B/ s$ F$ H% t5 r
ns_marquee.left=marqueewidth+8
/ [' h5 U: a/ d3 B$ j8 D6 V}
3 V7 g' Y$ z' ^( R}
8 [( f, V) q9 G2 M5 o5 O$ }# R3 p
if (iedom||document.layers){& W5 _' \1 U1 c# F3 h
with (document){' z4 c: u3 @! Q  j7 y1 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' w- v/ t" K) ?, b' k
if (iedom){
9 A, }$ E( v8 n) ~1 e4 @2 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& e$ B5 Y9 E+ m; G% T3 d$ Y1 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  \! W+ J( D8 z" H& o. J$ Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 l3 ?+ a1 N1 G2 D
write('</div>')
  z! r( D( x, Y2 p* {3 P}
9 J2 o5 m% l& K! C. g1 ^else if (document.layers){# N" C# v: [7 [. N( _% A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; z! p: t" s& A1 W' Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 |, _  ~+ w: E- A. {. Jwrite('</ilayer>')* T9 z/ m3 v& |; Y1 l6 v
}6 Z) v- a- p, D
document.write('</td></table>')
- s( j4 D* }$ w3 M  @}
+ L; P! i) J* i- G( g5 O7 B}
  T% x2 E: U1 g" @1 v</script>

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