返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ ?! A) n- C* _. |8 T1 n& G! b: \" Nvar marqueewidth=300
3 F, ~, d9 r( p. v, S3 O$ {. O//高度, ?3 o5 \. o' i& C& Z! s! z" W
var marqueeheight=25
% c6 y4 Q! {" z9 F4 l//速度(1-10)
$ O/ `3 t: Y; b' o  m* f8 S( Cvar marqueespeed=36 ^3 z, F) g: S6 |( X: K
//背景颜色
/ C& ]* Z8 @5 f( o; J# Q2 nvar marqueebgcolor="#FFFFFF"- b& l: t# @" ~4 u) }
//是否能暂停 (0=no. 1=yes)?
6 L, f) M) E% t3 e, svar pauseit=1
7 E& v( B0 w- r) I$ {0 F# V0 C9 Q6 @+ J" [" O
//修改显示内容
6 N8 V6 \, }& o: e% evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 e  |. h0 ~) \# W- E6 {

, [, l0 k1 u8 \: J4 a4 V9 e8 F
/ I5 b6 }6 E6 i////下面不需改变////////////' r- ?- @0 A0 R) }% R
6 r9 \# b; l: Y- K
var copyspeed=marqueespeed4 ]* u$ f7 x5 F! m8 r
var pausespeed=(pauseit==0)? copyspeed: 09 {6 U3 |# C' {6 B" @" I  r' F
var iedom=document.all||document.getElementById
6 s& S& `% y; E" Cif (iedom)4 B) f$ W6 i2 s( p; @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' |5 k0 L, n$ l; y) I* t
var actualwidth=''( z0 L  f* ]6 z6 Z
var cross_marquee, ns_marquee
0 M1 P7 k' M) i" ~8 u4 J5 A4 z$ p  S7 v2 m0 _, J3 ~3 z) |
function populate(){" f! p+ w% {" A' f* j
if (iedom){
0 S0 l4 H7 f; H' ^4 i  q) Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 B9 J$ o. B$ ?+ |, e2 @/ i/ M" g
cross_marquee.style.left=marqueewidth+8
0 n( m8 v# l( K: Kcross_marquee.innerHTML=marqueecontent( D* O$ V; y, v+ W5 Y4 O' m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 `8 p* p/ Y: s}
2 e' O8 _0 L$ H: Q3 g* Gelse if (document.layers){& B6 B3 d! ~( B9 Y$ v
ns_marquee=document.ns_marquee.document.ns_marquee24 \  v4 B% b, P0 a6 c. f! c+ _
ns_marquee.left=marqueewidth+8: ?# B" ~" B. p" i5 e; F
ns_marquee.document.write(marqueecontent)$ z/ K9 c, r! P6 M/ z
ns_marquee.document.close()8 q/ [5 j* k% I9 C. g( w; z
actualwidth=ns_marquee.document.width
0 d* h* ]. r* T6 s. q5 K6 n0 K; {}
  _* {5 J, n2 F& O# t$ B1 \lefttime=setInterval("scrollmarquee()",20)
# w8 v+ v2 ?6 r6 D}
5 e1 A+ Y% h. H) r/ G3 awindow.onload=populate
3 ^) W* Y7 A* k- ^7 ^+ a
9 d6 Y7 m8 q& m* o! h! Hfunction scrollmarquee(){
3 U# ], q4 M) I9 L/ wif (iedom){4 C9 [* H' i3 j0 N+ B7 c! [% L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 A, @5 X. `9 h, q4 Q, ^8 N, b# D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. u* }! H1 S# {4 Y0 j% n$ R) Kelse
3 P9 C4 _  {. _6 P8 Q' _) Ocross_marquee.style.left=marqueewidth+8, m& v2 b4 r8 r
7 X3 t; T* g% b+ [0 |
}2 n% p" p8 `; s: V' ~
else if (document.layers){
7 Y+ W* N; ~8 C+ N& Tif (ns_marquee.left>(actualwidth*(-1)+8))- A4 E- `( P- M: }9 u8 r
ns_marquee.left-=copyspeed
) E4 C8 ]; w" Q8 d, R; D/ Qelse; R* O: R1 [8 b2 z1 P9 u  A) F
ns_marquee.left=marqueewidth+80 }# k: D) V. M0 Q  \
}
* O' d" L! I; u) S3 `}
7 M$ ~1 X7 d) O/ D: e" f8 i) @" l  F, I/ i" e6 m* T3 V! {4 P
if (iedom||document.layers){
# a. b: H8 p. b/ G) J- @with (document){5 `5 G+ C( y! g" S. M& q0 }" C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# p: G0 O3 S5 O9 ~$ B% bif (iedom){7 b; u1 S7 ~1 G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), {, K$ h& M, {+ f, |  m; e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' I+ x+ @5 N, ?$ P4 I1 F( t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  ^0 g& J  Q- Z7 t1 u2 I
write('</div>')1 U7 O# {% P; a/ O
}
! @* f1 {+ T: X$ [- o1 |+ V2 Uelse if (document.layers){
# q  B! P& ^% _. ~! p! cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 X  ?+ g1 }7 g. a6 Q: X) |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! K/ b4 g/ e9 j, t  c4 E7 m
write('</ilayer>')
& F! A/ K2 ~3 o}
2 z* _: w" N* [' `. h3 Mdocument.write('</td></table>')
: H5 x+ e5 Y; D: Y/ Y}
1 d# v- d& V# }  F1 x}
1 P4 P7 V: Q& t/ i4 \</script>

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