返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 u" ^6 ~$ P( ^9 b( bvar marqueewidth=300) ~6 q6 d3 ]  I/ C) H
//高度
% E, S8 w$ d* A) e4 t" m! e0 pvar marqueeheight=25
+ i* ^! [# T5 g+ J) c% y' R//速度(1-10)
; _' a+ J' U7 r2 y: ?7 Bvar marqueespeed=3% ~$ ~: J" S1 d. x( Y: Q$ o
//背景颜色
% s' o; m& I9 X; ?+ l3 d. B- xvar marqueebgcolor="#FFFFFF": A7 m2 D0 Z4 L' L5 }) V. `
//是否能暂停 (0=no. 1=yes)?
# K- O; F# ^7 r8 w4 ~+ ivar pauseit=15 [0 J6 W* [* e
+ o; Z" o+ _$ G- G5 V1 z% [
//修改显示内容/ o, b' V  G) |+ g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! I8 \4 F& y! Y: ^, _
+ P. [/ D) S1 ~! z+ h7 e
" X. ^' n1 `$ L: x  ]. W////下面不需改变////////////
- ^7 }& @$ I/ P8 g. Q0 e! ]2 y3 g8 z6 U4 \9 m8 ^
var copyspeed=marqueespeed$ e2 y( j- w$ s* C
var pausespeed=(pauseit==0)? copyspeed: 0
/ a' i' E7 ?: Qvar iedom=document.all||document.getElementById. ^* @8 {/ {5 d6 m/ }
if (iedom)
" i* d5 w# C. X7 J6 W$ _% I% }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' s! a( A5 _' M0 p6 G, Y
var actualwidth=''
5 s' ~3 o, x, h9 Ivar cross_marquee, ns_marquee( \: U# y: A+ j, \( m- m& r5 W4 s: }  p
5 @6 l5 R+ R8 F* |
function populate(){- P# N* o3 H& ]1 a( s: R  |
if (iedom){+ L0 `8 _8 ]( _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* C1 ~; M; Z' p3 n& V$ rcross_marquee.style.left=marqueewidth+8  f$ W) N- h3 _* `. ], U  ]
cross_marquee.innerHTML=marqueecontent4 z7 b0 W) O) I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: S0 {1 n/ j1 x. }% o}& K" A! r2 @, p) A0 F: J
else if (document.layers){4 j9 R) U' Q6 T' h( p) T7 _
ns_marquee=document.ns_marquee.document.ns_marquee22 k( J  R, d3 B1 W* v1 _9 ^
ns_marquee.left=marqueewidth+81 [+ {2 X& ], x! i5 B
ns_marquee.document.write(marqueecontent)
* I2 i1 _+ z) X/ X; R' Z4 W) G$ }ns_marquee.document.close()
0 o2 N5 K8 L) z) \  |actualwidth=ns_marquee.document.width
8 F$ n& s8 K) U% l. m}
5 R9 A$ c4 e9 N7 N* H* \lefttime=setInterval("scrollmarquee()",20): o& p! @; R# A9 I" S8 u, i6 z/ d, W
}
6 C& H) Q0 ?' U# ?window.onload=populate
- v! d+ v! V  z8 }! x% F7 L6 n9 W8 \' Z8 a) Z+ T
function scrollmarquee(){' b& C2 T( d6 f
if (iedom){
+ A4 t0 V. ?) P) t, ~; Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 {' N3 ~; P0 t( c) G9 D4 M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; l5 B  s. P" i* a# @
else' z& t- p" Y& p  [' D# K+ M* t
cross_marquee.style.left=marqueewidth+8* `4 F8 k& W; Z, _: n8 }! [8 P( A2 U
1 x5 a9 \$ z& ?* B' u
}. r: E5 s1 ^+ R# }
else if (document.layers){# Y9 m% J( {, ~- P. a
if (ns_marquee.left>(actualwidth*(-1)+8))
3 r4 Y0 o2 x0 @ns_marquee.left-=copyspeed
$ S  P0 C( X/ F% J" J% l7 lelse/ W: q- L/ X4 Y: y
ns_marquee.left=marqueewidth+8
; z, _  T, v4 ]' }9 o7 _. e2 d}9 K9 b6 D6 z. S! j
}# ~  U7 q8 N8 j; v' d( a4 x

3 ?8 U% I2 f1 L/ Bif (iedom||document.layers){; `2 e+ G, x7 z  z( m/ r8 i
with (document){# [" n  y8 O/ ^- s5 K9 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), i  ?# M: ?1 ?/ K
if (iedom){: F! [; B4 b5 g+ Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) h7 o% q- j6 t7 @6 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. v6 C& [$ H* q% L# I$ s3 Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: p4 F# y% V/ \$ j/ \( nwrite('</div>')
  X1 k* `+ k  y7 {4 M2 a}1 h5 r% b1 u/ r
else if (document.layers){! o6 ~; e0 i2 c6 r7 u0 J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 R$ C* B& V- Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! y' o" A1 m: R3 g) @1 zwrite('</ilayer>')/ H, n2 x' c" D! p# o8 j1 c& B, r
}- }" A! j) h: \: Q7 S2 n
document.write('</td></table>')$ K, c, R4 _* d; m
}
# S" b$ [# k: O$ h6 I1 [}
3 d) L) R2 n) q& \: C& @$ Y</script>

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