返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 y) I' d1 p! P
var marqueewidth=300
+ M' `! ]! {! N8 h6 G2 ~* w# g//高度8 k4 R/ {$ N1 _" ~) `# I6 `
var marqueeheight=25& N1 d" ~) b& m
//速度(1-10)
: N1 {6 l0 q; h* Y- B$ wvar marqueespeed=3
" d/ d* s0 z) h1 ~//背景颜色
1 H9 C$ P* @' ^* t  Q  Uvar marqueebgcolor="#FFFFFF") a% T7 ?- J. \( v' R% L
//是否能暂停 (0=no. 1=yes)?
2 T! |+ w. |6 A5 ovar pauseit=1: F2 o8 n; Q/ ~% e
, X5 M: s! N: N. @) j' S3 [4 ~
//修改显示内容4 f8 s2 E/ t' G. o1 E; F2 C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 F/ s3 L: k+ J, i

3 x: ]0 V6 T& h& Y: j; D% i( Y( x% S' Z/ Z$ @
////下面不需改变////////////
# I+ c+ w  _' m% J
" `! d0 g: S0 J+ \var copyspeed=marqueespeed1 s; c9 ^+ a4 q4 ]/ |
var pausespeed=(pauseit==0)? copyspeed: 02 N& e, y9 \+ h9 D. H0 G3 q9 n6 p
var iedom=document.all||document.getElementById
: ^5 |) L+ P, x0 S1 M& J- rif (iedom)3 K* t* n' O+ i: {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 \( Q- w2 @7 yvar actualwidth=''6 Y) y. K6 A7 z1 O! Z* P
var cross_marquee, ns_marquee
  w; Z' _$ @0 m1 c7 l9 {/ U  ?, H3 Y3 \' f% c: I  |  M
function populate(){
0 ^! c  G/ i2 p( Lif (iedom){
/ G3 b; e7 F6 y8 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& ?1 E! q, Q; G. b( l4 V( n6 y
cross_marquee.style.left=marqueewidth+8
' n/ r  {6 c# G, I: F! }3 N  g  Bcross_marquee.innerHTML=marqueecontent
, L1 d4 f' H. W- k; T9 _" Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ Q* d& }/ b3 {& k# A  I1 A4 }
}
' ]- R7 Q! l  E: B1 yelse if (document.layers){
% j& q: ~9 a; |" ~, Y6 F1 f' wns_marquee=document.ns_marquee.document.ns_marquee27 t( b. {! f: n1 c
ns_marquee.left=marqueewidth+8
+ {. I( I8 ?$ F) P: h/ ens_marquee.document.write(marqueecontent)
# g$ b% f+ i  A# Z3 E, L' j3 }ns_marquee.document.close()
' u: q! n+ j5 h9 H1 q9 eactualwidth=ns_marquee.document.width
. g& B5 g1 s4 N5 e  s' G}
. y  C& |# j9 vlefttime=setInterval("scrollmarquee()",20)
; E5 _2 v  z% l8 Y* o. w; T}
  b4 ^7 a3 r' k% l, u5 }$ Wwindow.onload=populate/ m( X$ H4 w1 J9 c2 M

& }4 ]4 \, \6 A) Bfunction scrollmarquee(){5 u2 [# a. t! b' c0 q; a% n
if (iedom){
) I, X. W, b3 q" a; e- \. aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 q2 s. w, {; R% ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  ]# _4 s. c; Aelse" ?( \" Y! d* P  n$ [
cross_marquee.style.left=marqueewidth+85 B5 u3 R1 i; g/ Z) O, f1 Z
: w- Q1 p8 p# g) H
}
5 W( n. h& w! m: Jelse if (document.layers){
4 |9 @+ Q9 o: W' ?$ F3 vif (ns_marquee.left>(actualwidth*(-1)+8))
) s) H* K7 j" L* t% Cns_marquee.left-=copyspeed
$ U; ^, t8 P1 T( \  L) Nelse
5 Y% V+ E5 `& \+ [+ u& H" ~ns_marquee.left=marqueewidth+85 w, [2 ?  B% `/ G; g( x* Q
}$ d6 g2 k  {0 W: E9 s( g* y. s
}8 h8 x# U8 y3 H2 b5 U
4 l6 s0 }5 g  y5 p8 d8 b
if (iedom||document.layers){) u0 r2 n4 Y$ B. |4 |
with (document){* Z1 [" _6 Y7 }& v3 {0 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! ^1 ~# H" I( \
if (iedom){5 {& b) H. l9 J4 c, X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- A7 D# M" M! q8 e5 y2 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: H0 y4 Z/ `: {" ^9 J1 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' J) W+ x+ j$ ewrite('</div>')
/ G' \( h( N- d/ z5 ^}7 d; p! c2 U" x1 }( p) F
else if (document.layers){/ q# e! d+ [/ Y) o2 m9 h. G, {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& D/ a7 X7 V9 [: Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 B  C* |1 o. Y; z2 W
write('</ilayer>')& d" s6 I* p/ H
}% R5 V& B: \5 h- c* V
document.write('</td></table>')2 D  S2 ]5 L) w5 x& w4 S3 W
}
5 r4 H  J7 r8 l# L+ X* i}& [8 ?% L+ N# ]6 W
</script>

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