返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: H. O% n, u- {  v! avar marqueewidth=300* T) R1 S% Y3 K* [% R
//高度* y2 @- J% y0 Q1 I3 `
var marqueeheight=25
& G# y8 C0 @; G1 d% u//速度(1-10), G* M( U( z" B5 K4 P
var marqueespeed=3
; ^9 b6 f5 x6 K) G4 W//背景颜色* ]& K6 L' T3 Y* m2 C
var marqueebgcolor="#FFFFFF"
; G; D; O: c* n( r0 g3 d, z7 w5 S//是否能暂停 (0=no. 1=yes)?
- l! R4 R/ S5 q4 J2 f; M' Z. svar pauseit=1
) q, f0 v! q2 x: y1 j6 Y  T  @. h& A( m5 s& u& a
//修改显示内容! D7 t% N& ?& N% |/ w, [: r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: S) i5 q/ Y6 ?4 R7 R; q( w# o5 X+ f) y6 r  [  M

  H! C* o2 y% J3 [9 s////下面不需改变////////////$ b* g/ e' n  l# L6 V) Q6 `# p6 C9 g/ l1 g
# n0 y; F+ E7 P
var copyspeed=marqueespeed
! R1 P9 G8 U( K& E9 w1 ]var pausespeed=(pauseit==0)? copyspeed: 0
  P# o. O, v( e6 @$ v( W& u2 Mvar iedom=document.all||document.getElementById
3 I" y; A) G, ~& K, ^( pif (iedom)( h( z/ N2 p' w: E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! }4 ~9 [) C7 T" O$ I3 A& K5 Hvar actualwidth=''$ x. r- W) \' g; B; {" E, o! ~
var cross_marquee, ns_marquee6 t( l; G* D. E5 {( B4 H) E

2 `5 W3 M" K* v# Cfunction populate(){
( V5 |0 Z. J. c8 _2 W* Y% ]if (iedom){
5 W' N  k& M+ {' H0 T. `0 s7 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% [( Q, @, }' I
cross_marquee.style.left=marqueewidth+8
- [% b& o/ Z& ?2 a1 ?8 bcross_marquee.innerHTML=marqueecontent2 ~/ ]" b/ ]6 o  Q1 [% y$ P+ }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 e1 A: n" Q" G/ `. b# V( @/ N; h
}
0 F" s7 {* [# Aelse if (document.layers){
4 ~9 j; S( s  {' ^0 |ns_marquee=document.ns_marquee.document.ns_marquee2
! [2 N: @3 Z# j7 F  h7 Dns_marquee.left=marqueewidth+87 w% C6 b8 {6 S% U# C3 W! c
ns_marquee.document.write(marqueecontent)
" _8 W- o4 @. Y/ t- `. rns_marquee.document.close()9 ?" [- _6 _/ V5 N+ |
actualwidth=ns_marquee.document.width
+ q# h& E( j$ A- z3 ~' T& T7 q}: k6 ~6 v+ l: G. l9 }
lefttime=setInterval("scrollmarquee()",20)5 A7 b6 S; q0 y0 J9 p
}, H; ?  T+ q: |  t2 {. O+ u! n
window.onload=populate  U' l8 e- d& I# i+ b2 y* s
  w! J: k' l0 d' E. c
function scrollmarquee(){$ Y( ^9 ~! `0 J( D( m
if (iedom){
( V4 \# G2 o, s9 A: |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' [/ ]# K4 d) w: c7 n& m7 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; }" @  p9 m; b
else* p4 Y$ E/ m6 k$ a" `/ o) ~& V
cross_marquee.style.left=marqueewidth+8! w0 f1 o# \6 f! r) P5 O$ c; v: a

& y5 Q4 ~& G5 Y$ Q}, O2 X, @! Q, C! K4 r' l
else if (document.layers){
( U/ p* l/ V7 C# L# e/ e: gif (ns_marquee.left>(actualwidth*(-1)+8))# `6 k  J$ ?1 ^
ns_marquee.left-=copyspeed  X* d/ R0 u' W  X' M* L% j
else6 K! T( W3 Y1 C$ q! q7 |2 Y
ns_marquee.left=marqueewidth+8
2 o. m9 ]! b4 U$ f}
% u' o2 K0 N4 u5 c) C7 y}7 E/ B9 q, l" H8 y

) u5 j7 R, ?; X) K0 N- Oif (iedom||document.layers){7 S# z5 `% L( m6 h2 r1 D
with (document){9 t6 _* C' i: F4 ?* u1 c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 U6 R% h3 b) C: z& dif (iedom){
& K5 k7 m4 S6 \& ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 v. a# v1 }' R$ V9 W" S  ^" iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), e. r! V3 @7 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 K# @3 n* d8 L0 m# E
write('</div>')
% d2 a7 ~: M4 S& g- R3 t}% R1 R! ]! a1 f6 i  l: Q5 n
else if (document.layers){1 [( B1 A7 a, U, s' E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) L' i: Z7 V" b( J( R+ n4 n6 Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# o& p- e7 \* v! @
write('</ilayer>')
) V0 S1 D# f* |}
" l! I/ O4 {6 }document.write('</td></table>')
' a6 M5 V; |# D) r/ \+ m' r}) p: Y% \( O9 H; G) v& @7 [$ }9 O4 W5 a7 n
}
  C$ f& k! u6 ^</script>

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