返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, x; O- w$ p# C: N" b) F0 u' `" G* tvar marqueewidth=300: a$ H6 Z( Z  L9 \
//高度0 v. W0 D* _3 N: E
var marqueeheight=25; x" ^& v2 T0 ]2 m* \+ E, f1 |
//速度(1-10)
% C* Y3 s5 s& b; a% Wvar marqueespeed=3
# y3 K& n8 p9 S+ o1 E4 v//背景颜色
- S' P! s% ^+ ?; {* c0 W$ W: E, ]  zvar marqueebgcolor="#FFFFFF"# L$ H& Y, ~$ t4 H" M0 A, Y
//是否能暂停 (0=no. 1=yes)?
' P; E# B- {$ ]3 c, n+ R+ G* g7 Vvar pauseit=1- B# V2 J3 ]6 H* a3 B
* \& d( D0 V) G2 l9 a5 o, f
//修改显示内容
1 c& g) ^$ s' V1 [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% W$ e1 s" m! L% ~* x4 Y( V, S- J& S8 U" Q: E1 {
' P5 ~% \# J1 K+ u+ b% |! S
////下面不需改变////////////
* i& A' N' o& {! N3 r  c: Y+ B8 b. r
var copyspeed=marqueespeed
9 I- f  S4 B7 {0 s+ N3 W6 Dvar pausespeed=(pauseit==0)? copyspeed: 0
. r3 ]* b, V2 C1 r  X' w; Jvar iedom=document.all||document.getElementById2 ^+ D' z8 r! f) a+ V8 x4 I$ N* W
if (iedom)% V: l; f. l- \  B& P; ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; R, a5 {# s' c; v/ ?. {1 |4 pvar actualwidth=''' V2 N* d- P4 q0 t2 D8 A6 d; H, l
var cross_marquee, ns_marquee
+ Y. w& F- x" w2 P% C
; U) N! X$ \0 ]5 A7 E  h. gfunction populate(){
6 p. T: y9 z# Pif (iedom){
$ e: y- S5 D7 G+ T- rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 k0 ?- r5 k% M& Qcross_marquee.style.left=marqueewidth+8
" C& v' g# j* W7 X) _cross_marquee.innerHTML=marqueecontent
. m6 k# B& S* zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 b: _4 M6 Z' Q, X+ g
}8 m5 I5 i0 Q. q4 y% r: \
else if (document.layers){. [# Y4 E% `, j1 p. h! ~! O' K& [. V
ns_marquee=document.ns_marquee.document.ns_marquee2# T' O% u7 B. V4 S0 n4 N
ns_marquee.left=marqueewidth+8
  [0 ?, O2 P9 y; Nns_marquee.document.write(marqueecontent)2 q+ l  E5 d: Q0 [- i% t' {% y
ns_marquee.document.close()
& T% B/ I% x9 s& ~/ h! k, l2 d+ Aactualwidth=ns_marquee.document.width
6 _- g) i5 k' W; S}
4 K6 M$ d- y* slefttime=setInterval("scrollmarquee()",20)$ v0 }1 I; g" o( Z" W( h, u
}
( }  _( ~* A7 b% m- Dwindow.onload=populate
8 O7 \7 i# [: D6 u" w- R, o$ x$ v8 B6 Q# k7 P) |* B( s
function scrollmarquee(){; b2 t6 Q8 c2 ~6 H% Y  d+ r
if (iedom){' j! c1 Y% m; H- ~+ t* ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ n7 s1 C% p  Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) D0 {( j  i0 E- velse
! e* p) j5 i4 m9 a$ d9 xcross_marquee.style.left=marqueewidth+8
3 \8 z) M, t3 \. W+ v$ P
% M  d: N/ S: ?, J( |}
) ~; j0 L: V' h* @# [* a1 \% H. {else if (document.layers){5 Z/ q. _5 D* J! `# g
if (ns_marquee.left>(actualwidth*(-1)+8))! C6 E5 N( F: C- z
ns_marquee.left-=copyspeed3 O2 P; z: t% w* M5 T4 |
else
; h. A; f1 D! g. s7 r6 V: y  Uns_marquee.left=marqueewidth+8- ?  F# b$ M: T1 D9 {2 j7 C. E
}/ t& U! T/ W  H! ^+ g
}
/ Z3 C1 @5 K( y* |7 Y6 `" |3 `9 o" m3 X
if (iedom||document.layers){
+ r( O$ ^* K9 C" d, E. ]with (document){! k) p# P9 F3 w4 h9 g6 G/ _9 B& N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- p! B7 M( y2 ?/ F
if (iedom){
! w# i0 E3 q' Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), ]! x, }* Y5 u1 j" ~# W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 V3 E( s/ H# I& t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, P0 M  I# O$ ~4 \! Q+ F7 S5 W/ w( wwrite('</div>')
1 g0 Y: t8 w. L0 ~}
' `+ ?- z5 A/ j" ], ^) delse if (document.layers){8 z& {3 B4 Y: U/ z. K' I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& W8 g, \2 \4 W* \+ V& Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); @+ j# A2 |# }" u
write('</ilayer>')8 o6 t5 i# N8 Q! s3 x
}
- h# v& v+ i/ N4 Cdocument.write('</td></table>')" o' {- F4 S% C
}
) Y) i3 X4 ?1 O6 `}" r' i( R8 L7 d. [+ r, B' _+ o
</script>

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