返回列表 发帖

网页之跑马灯文字特效

//修改宽度* Q! c# a# S& }' ^: a7 y
var marqueewidth=300
( M7 o) a' d& ?2 Y" o//高度
' {4 [0 y: `; x& `var marqueeheight=25$ ^) y2 ^* c+ Z" a
//速度(1-10)
6 F; n/ s! ^. T8 a8 U0 t. jvar marqueespeed=3
9 W7 S& w4 J2 L3 N9 W3 F1 m//背景颜色
. L  r/ o% s( {/ k# F0 l; ]var marqueebgcolor="#FFFFFF"  h1 n. J; U; \: u/ `1 r0 h
//是否能暂停 (0=no. 1=yes)?' ~6 w0 }6 U6 O# g! x; z3 i" f% c! y
var pauseit=1
0 e3 y4 X4 m  y$ a6 @9 q+ f& X9 A3 b1 g+ p" U0 q2 R
//修改显示内容
/ t8 _% F" c" Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 J' V8 b9 L  m
* ^& ^8 p! ^5 ^
0 T' v) @$ z( A3 v
////下面不需改变////////////
( H& l4 k$ F) U% R% k! s
6 o  _3 A- g$ q, avar copyspeed=marqueespeed
7 I' ?$ P, L; L7 Rvar pausespeed=(pauseit==0)? copyspeed: 06 a& S. h. M% ~/ b8 s3 u
var iedom=document.all||document.getElementById. C4 P' P+ y' @' ^% c( U# B% P
if (iedom)
2 ]1 U% l, r8 W3 K% tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  i+ I8 k) Y% g3 X9 }. ~var actualwidth=''
' b* u  j2 q4 B' i( Svar cross_marquee, ns_marquee2 S+ A: Y' R& x9 r2 V+ h# I
3 [5 h1 K, p" T4 x/ f
function populate(){5 n9 H0 h3 i0 X
if (iedom){# V- T$ J4 }) `# J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# T# L7 G8 j0 ~! @" x0 w' N: U
cross_marquee.style.left=marqueewidth+84 t: Y, K* k- p& Q9 d2 ]; W
cross_marquee.innerHTML=marqueecontent
0 Z6 V; V) e* d( E8 G7 hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 |" z0 K# e! ^( o0 |# N
}% n5 n8 d. S% n+ v4 O5 j% M
else if (document.layers){: K; n, b, \! ~5 Z  K
ns_marquee=document.ns_marquee.document.ns_marquee2; u: r* |5 \7 _* f
ns_marquee.left=marqueewidth+8
+ c/ C3 o5 t6 G" ]) ]ns_marquee.document.write(marqueecontent)( I/ `8 G* V) F: A" F. L' b& A" P
ns_marquee.document.close()
3 W# t. N. {% m$ U9 ~: U; B& h- `actualwidth=ns_marquee.document.width7 {5 L0 b" G: d; f4 _2 [+ J& x8 ~: o" I
}/ r: }) t" E& t7 S6 m3 J
lefttime=setInterval("scrollmarquee()",20)
. J7 E: x2 h, t. V. a8 Q}
% H4 l, G6 w7 j* swindow.onload=populate
6 }/ B. S, p" j3 L, B) ?2 I7 W8 q  C, c3 x
function scrollmarquee(){
# i3 ?- X$ j# ~( P6 H7 tif (iedom){
0 ^" T& D) Y7 g1 x% |: z( x% kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): q5 X, b% z* m4 ?& U$ N/ ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ \; _* N$ V. Celse& F& ?7 o) m% j; h, [
cross_marquee.style.left=marqueewidth+8. c2 H1 ?2 ~, `# v* k8 V3 u

: L. `+ Q  i" k2 u4 n5 X}0 t* Q, t/ q4 |4 h; ]
else if (document.layers){
; I% G/ q' x4 Mif (ns_marquee.left>(actualwidth*(-1)+8))
4 r( [. i1 s* V. S# |ns_marquee.left-=copyspeed/ M7 P  A/ k! G) m- @
else) `% ^1 W- ^. x/ V0 g" G, E
ns_marquee.left=marqueewidth+80 \7 C; h) Z1 ?; ?1 J% j; U
}
- D8 x$ p2 k1 V2 i" X}6 _( b/ h6 v: f4 r7 @
& I; `& G) {5 }& f. G
if (iedom||document.layers){
  n! N1 U6 F% n7 Dwith (document){1 L- \4 M: Q3 G: t& |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 Y: t1 ^' ~* C4 D+ Y- xif (iedom){" i* k  h/ [. n; R* K, Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* M1 N% f& a( m5 W: a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" R& N8 T9 w( a" o2 V  R8 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* o) D' \0 f$ U0 f5 _( Vwrite('</div>')8 B0 Z0 j' W9 D  p" H* v
}
9 v' F7 U7 w& ~7 L9 p" F6 ]else if (document.layers){
  S' c, v. z; g  ~) n; p4 B. Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. ], U7 e) o$ @' U" ?& B# K, Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 }7 Q6 i; I6 O9 @  A- Twrite('</ilayer>'): ]& T/ H" D* j; \" J9 T; r: A
}  p1 _. H% w3 r1 G
document.write('</td></table>'). e4 t* _0 \6 J. P  i  x- j0 F
}7 q/ c& }" h% M, O/ E& }( A9 ~
}4 Y) a, T; ~9 E# S  X+ j. ?
</script>

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