返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% r$ \6 f/ v& r9 a8 O) b& P4 Xvar marqueewidth=3009 i3 u4 `6 s" v0 n; D  ?. I3 b) q4 L
//高度
0 R/ |2 C. S1 u$ y' |5 }/ gvar marqueeheight=256 _: x/ M5 B. b' Z8 X" O& ~* q" P
//速度(1-10)0 ?% B& R" V& r3 k
var marqueespeed=3
+ L9 ]0 O1 o0 D$ g* ^: v//背景颜色
/ Y! u. m' k& U8 z" c# \9 svar marqueebgcolor="#FFFFFF"
5 q* A  n/ l* l0 ?8 b//是否能暂停 (0=no. 1=yes)?
$ \! @/ j: z9 S$ E- U. M+ Rvar pauseit=1
2 E2 {1 C+ O' |/ f9 G" S6 }! K7 }( u- u3 Z, v4 l
//修改显示内容, S0 u) ?) [1 K6 F, W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 C$ ?) v$ x% z  P" K
8 a$ o" a# c, Y+ x+ N4 o' T; d0 {" \" a" n* J) w4 h  v: t
////下面不需改变////////////0 ?6 J! R6 ~' Y$ |0 y9 W$ u9 V

+ `7 m  X, y8 p. e4 B) ~+ n5 j# M$ N. Hvar copyspeed=marqueespeed5 ~+ K) W2 t, m. y) j0 |3 u
var pausespeed=(pauseit==0)? copyspeed: 0
4 @  J7 s: J0 Zvar iedom=document.all||document.getElementById
  k) p2 T8 D& k2 Z1 ~" B2 c2 mif (iedom)+ w5 g$ Q; ^. {& w/ x6 A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: x3 h" ~2 ~9 r  n, r& P( B9 qvar actualwidth=''
. ]6 c  y# }9 T: ?var cross_marquee, ns_marquee& \. I2 \6 G) y" w$ Q; \# t" O# G- J
7 b* B3 [6 U9 Y% C5 T
function populate(){
0 [! r5 u- J0 b( `; Uif (iedom){$ v) l8 ^2 N2 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# C; V8 j: E/ O. m% `
cross_marquee.style.left=marqueewidth+8( d" p7 f% x; }0 C6 R
cross_marquee.innerHTML=marqueecontent
0 A3 ~8 \" Q9 k8 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. ?9 U. N! A4 E7 Z  ?# ?
}' n, a2 R/ a9 S* ~
else if (document.layers){
" F  {7 Y& z3 }! mns_marquee=document.ns_marquee.document.ns_marquee2
) i1 f2 j1 i3 ^ns_marquee.left=marqueewidth+8
5 s* t1 f" F) z" v- kns_marquee.document.write(marqueecontent)
: L& s% [( s3 Cns_marquee.document.close()
5 d! H0 x  m4 q' f8 K+ v- Y8 Uactualwidth=ns_marquee.document.width- {* _  [" M& }3 l2 ^- O
}+ W: N% S0 ^% B) u/ }- ]
lefttime=setInterval("scrollmarquee()",20)
; k; {5 w$ t/ L5 e, ?  T- }}: ~6 E( J' K- D/ l( o4 h
window.onload=populate2 R$ K  Y8 z! y& V: T; W$ ]

( k+ g+ a6 Z  D5 t  a  b7 wfunction scrollmarquee(){7 M2 B& w1 j! C1 x( t$ I
if (iedom){
! T  G; j$ s/ Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 g" w6 U3 ]; i+ ^6 p7 d) j5 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 k# O- s/ w+ f1 l) Ielse
0 g* w% p2 ?! O. }6 |( Ocross_marquee.style.left=marqueewidth+8
2 z1 |) q9 v$ d8 |9 Z, k6 `  O
  n" c1 r2 J3 I: g}0 u: t4 ~4 Z* p& S" Q6 x8 i
else if (document.layers){( x" j/ b" c0 i* [3 l
if (ns_marquee.left>(actualwidth*(-1)+8))* j" m+ W6 ^: `1 K. ^; w0 p  d# \
ns_marquee.left-=copyspeed/ b! f$ A& k! ~2 m
else
9 a( x2 o' P/ Fns_marquee.left=marqueewidth+8" ~6 ?5 v( ~; Q
}
: F2 z) O! L0 d# X4 [/ n! D}
. N- L! N% v' [) o2 U2 Q& B* ~% [% R
if (iedom||document.layers){
, M4 `9 J) J( D* _; |with (document){4 w6 e: y1 Y; A- {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). r" [- w3 R+ O8 V
if (iedom){4 Z8 b: Y9 h/ l1 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) W9 @5 C6 X/ |8 ~* r. [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 n; V' V3 Y+ I8 o4 y1 i( p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" `+ s4 t) q6 @  S6 F& l9 iwrite('</div>')) ]! y% V, t) g* j& b
}
0 H/ J" _7 F/ l# _! uelse if (document.layers){
$ t1 R& }" p) u! P5 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 ^* ]4 F, Q/ `% J' @2 U: T5 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 M9 Q. D8 {+ G* r- b3 g
write('</ilayer>'): H! V+ [; C' l# ]$ Y  `
}' c$ X& a- {) X7 Z, z) d& `
document.write('</td></table>')/ x8 @$ S6 M' b1 V8 L
}! w0 \, ]3 C0 V& F
}* q( f3 _4 W4 ?5 U% }6 f5 t
</script>

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