返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 W0 ~! J( _5 Y* X! o
var marqueewidth=300- M& p& |/ K% X* T
//高度
- g" i; @) B$ q+ uvar marqueeheight=25
) H; W6 ?6 f% P( D) y) V//速度(1-10), }( z% f: P; s. s* Y! i: |
var marqueespeed=3
. q$ b' L+ _0 W$ Y$ U/ ]//背景颜色
4 u% o/ d$ D4 I4 X! [+ e+ Bvar marqueebgcolor="#FFFFFF") S0 i% Y) l3 t* O9 h$ R+ P$ U
//是否能暂停 (0=no. 1=yes)?
5 L9 ~! Z3 _' C/ H  R; Fvar pauseit=1
4 R- `8 J9 v( c4 F- Z( ?' i7 h! E3 L1 g/ o2 V2 ?
//修改显示内容( t$ E7 F9 n0 D/ b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  [( g: w- \9 w; ?
4 x) B0 K* A/ j$ w3 M
) w4 q$ G5 W( z+ v) `" }////下面不需改变////////////+ d3 N, L  g5 p7 c0 q

0 F# P2 ?( J/ m7 Rvar copyspeed=marqueespeed3 E% V1 L5 M0 h- t, V
var pausespeed=(pauseit==0)? copyspeed: 0
% g( E6 A+ Y* N8 v3 W0 Svar iedom=document.all||document.getElementById- D: X/ d: A6 I% w6 q" R- j
if (iedom)
! [7 ^8 X/ D$ idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# |' N0 N0 U) \5 }( ~0 \$ _$ x
var actualwidth=''
* u. Z- r* y7 }) G2 Tvar cross_marquee, ns_marquee
+ C0 r! Q6 U: e% _; q
; t; s9 ^3 d: ?2 B% P: {2 ?function populate(){. p/ \7 g  Z! W/ r2 O/ d
if (iedom){. W1 T+ \. J. l; a$ [6 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 n0 W. c# {; O+ B0 x; ?8 D
cross_marquee.style.left=marqueewidth+8' Y1 l( h8 S/ m
cross_marquee.innerHTML=marqueecontent9 I) \, d- C" V5 y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, o% o; [  g5 i' s. [: e8 K! {
}- P" N/ F8 ~# v  ?+ q# r  _# s, R
else if (document.layers){
3 F& W$ A9 e5 j/ }+ g# d- {ns_marquee=document.ns_marquee.document.ns_marquee24 i0 g' F3 l8 F6 M* W. [3 m0 {" Z
ns_marquee.left=marqueewidth+89 F$ w+ S6 I9 U) W* Z+ r3 m( l
ns_marquee.document.write(marqueecontent)
8 B: }9 v3 t& Y# @8 g9 |ns_marquee.document.close()3 r. U4 p8 s+ `6 W4 U
actualwidth=ns_marquee.document.width" k' S9 q9 o# D  C" J9 p4 u
}
& P$ U) T3 [0 T0 }6 Tlefttime=setInterval("scrollmarquee()",20)7 D1 q. @1 z$ c* W
}
" O; S$ }  _3 G# B, e+ wwindow.onload=populate( p% r2 |  p/ ?6 o- m

; G1 t) [0 P' A+ H9 b! xfunction scrollmarquee(){
% T" F& }& _& w+ ]% rif (iedom){. k- s5 L: A# u; d3 }" N5 Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  d5 E; M8 G3 }2 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 V* K" [7 q0 S# Oelse& ^' i) f/ o: W( ]
cross_marquee.style.left=marqueewidth+8+ N* n  f2 d4 m- m
2 }# ], I: H' `* |5 Y0 n" O1 E
}7 {( l$ |" ~( p: [8 t/ @
else if (document.layers){
! n5 a" u# g' S5 o# qif (ns_marquee.left>(actualwidth*(-1)+8))
; i0 Q& W" `. S9 P( Bns_marquee.left-=copyspeed3 n" W  W* f0 l1 c, Y$ u
else6 V) Y5 \" n( ]: R1 C
ns_marquee.left=marqueewidth+8+ ?) K+ D1 D% ]5 |  H& P
}
6 n0 ?( T! o8 G! p. {( Q2 Y& T}
& j1 D& s5 ~" [5 f7 S. q3 A" e5 [6 B+ L
if (iedom||document.layers){" ?8 S" T2 H* t
with (document){
/ ^- Q# _; _; o' [6 f+ @# Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ \8 F) z$ A) {% R7 m$ |
if (iedom){7 L  l! o( v0 X% t- I  j8 O% w* g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% y% Q8 P) U) E1 ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, h% }; e, _" G/ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  P. \9 y1 F6 _  ?8 \" P5 [5 c
write('</div>')
, c- S, T3 s2 B' x( Q0 I}7 p9 B8 b# B% w" ~' I- f/ F5 p+ e
else if (document.layers){
- J" |; p4 D# O( n9 G# Y7 w6 _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! g, a) f1 `& B- ?. u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  r2 |2 `# k% p  W: [6 ^write('</ilayer>')/ m) x% [* T% q4 t+ d
}
0 [! g5 {4 t2 I5 ?document.write('</td></table>'). m: q, S2 J7 |) b! v9 W  w; P
}
. R$ F) G' b" u! R9 Q( G) f% p) `}& _! C+ _% S& Z2 v1 x
</script>

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