返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 |8 j: A# z& t- h: Ivar marqueewidth=300
/ W8 w/ \9 \0 O7 h; t8 I. n# a( d0 g//高度3 \  c2 J& d- |- @9 D
var marqueeheight=25/ S. n+ v, _! M1 c
//速度(1-10); i  Y  H. H* `
var marqueespeed=3: q0 i* Y6 x; l" _( W+ O
//背景颜色
$ l7 s: f0 b6 Y1 A- U8 `var marqueebgcolor="#FFFFFF"
( {: W2 f, ?/ y. Z+ Q& b//是否能暂停 (0=no. 1=yes)?: L. D/ J: r8 r$ [1 X' P( Q, k. u
var pauseit=1
; T, {. h; S* ~; H0 k+ s; N: i6 S2 n5 a
//修改显示内容4 f' V2 E) x4 i* T! E; c' g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& R. \; t! \$ d2 Q

. N$ G- c" r. [8 B
+ n) g# [: M3 P% l; f6 k////下面不需改变////////////) k% W0 k, }. T" G
, r+ N- W' ]$ U7 g" D$ t
var copyspeed=marqueespeed8 @3 e. |; y. h
var pausespeed=(pauseit==0)? copyspeed: 05 I$ K, }8 H% p" h
var iedom=document.all||document.getElementById
# R  N! q+ Z1 ~if (iedom)+ l3 v7 Q( W' L3 j5 P7 E3 K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 ]" C. b% [5 u- P3 d7 T
var actualwidth=''8 h9 g% F9 e, s, [$ m; u
var cross_marquee, ns_marquee
9 f! _3 E. C/ M- D0 _! G; S- {! Z, p0 {" X5 E' y7 ~$ D1 h
function populate(){
) S) t, r& A4 |& J' Mif (iedom){* h' N! d$ Y" X7 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 Y% |8 q7 ]8 N" k/ Q/ A
cross_marquee.style.left=marqueewidth+87 S* e) Z) o0 P, z- [0 F' z/ L  n: P
cross_marquee.innerHTML=marqueecontent# ?* j/ y; z7 r* T- K7 E8 |( n6 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( C/ C+ I/ c+ `1 p( c% m4 p% x
}4 r" l  K) C* Y! A' V! \5 o) w
else if (document.layers){# y6 k/ m/ h% \# s3 l/ I
ns_marquee=document.ns_marquee.document.ns_marquee2; |- I/ J) v6 t7 @$ S( H; m
ns_marquee.left=marqueewidth+89 I$ m* w6 D2 P$ F
ns_marquee.document.write(marqueecontent)8 j: i* @1 p0 {; z
ns_marquee.document.close()
1 l' }2 O. L4 l. Y& Pactualwidth=ns_marquee.document.width4 B# ?! i1 V  T0 u6 O: m4 D
}
3 n2 r- z* K  x7 x1 glefttime=setInterval("scrollmarquee()",20)9 U$ S) p# z6 i; z$ C) x
}- d- g+ Z5 j1 F6 C8 O7 G7 ?/ k# n
window.onload=populate: W) R3 J' V7 D/ \# L, h

1 C1 A& ^: r2 n' v7 _( _9 sfunction scrollmarquee(){
0 n8 N, Q2 `( S$ i/ gif (iedom){) S9 y2 w) A* H9 _) Z8 _7 T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). a; X9 y3 V$ K# @" D4 N" h9 |$ l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# M3 ]$ k2 @( aelse
0 N. v9 x6 {* x/ t. u0 O* L. lcross_marquee.style.left=marqueewidth+8
( M  g  T5 ~  M2 C1 S  A
, u, H* b" d+ j- o2 i% z+ x}
) u2 r0 I; ~5 a- H- q- Delse if (document.layers){3 T; ?; m# {- P! e
if (ns_marquee.left>(actualwidth*(-1)+8))
5 i! ?$ v' i. L# r2 sns_marquee.left-=copyspeed
) {' ^# s. r1 ?( U6 ^else
8 \4 i+ F  B* n8 kns_marquee.left=marqueewidth+8
: f! R+ T, ^1 y' m" j}6 |2 V5 x4 i& G/ v
}  k3 _# L; M! a' h9 }

  }: @' b4 q3 kif (iedom||document.layers){
0 S1 t6 k) G. ?9 N0 V+ A2 Z2 f4 nwith (document){
1 }1 b& m, }4 p  Y4 O) v" ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 X; c" ^; T) c
if (iedom){, n# B/ \% |, M* J1 @4 ]7 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ G7 c: R" H3 }8 Y2 I) }+ Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 s% r+ Y) E9 _* d4 }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ A' K# v" t5 W' r3 w: d& [write('</div>')  z) w* R$ \4 N  Y& h
}# d. ?* F0 }( m6 A5 _
else if (document.layers){
  k8 a8 s$ o6 Z, E' Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). r* n  w, s' F0 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" c3 B! @3 c) f
write('</ilayer>')9 D, [! X( N; h/ f/ \
}
5 V0 ?5 b1 Q! C5 ~% \document.write('</td></table>')
1 L3 ^* E7 ^3 r5 K8 k( H5 }( n}
: I  h% C; `' ~/ \1 T}- P* f! w% Z. F! Z. B' w, V
</script>

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