|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度# d/ c4 |% z6 w) B# c0 p* K
var marqueewidth=300/ @$ t; K7 m( I( u, j
//高度: o1 K3 ^3 d! ~
var marqueeheight=25
" N+ s2 e. W' K+ W6 [9 f$ O$ T//速度(1-10)+ d O' g$ A( \1 k8 |; r0 G
var marqueespeed=3
0 D/ |* f; E4 |+ o. l//背景颜色6 a% n0 h, s. [$ ~1 j& G# Y
var marqueebgcolor="#FFFFFF"9 P# G6 j$ t+ V. T" n
//是否能暂停 (0=no. 1=yes)?
( e) A. c- U7 v# S4 R2 `% E& mvar pauseit=1
' H3 H3 N: m. Z/ z- T3 _
" l- e6 e2 O# j) w O1 h$ p//修改显示内容
! \1 E$ P4 o6 k+ ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 n+ K+ Y8 c; Z
" R$ }# F* @- g: _4 d7 U# s, F0 Z% \- q, i0 l
////下面不需改变////////////
& K8 S5 S2 r5 `3 U' ~- B, j: T7 s3 b, ?5 [
var copyspeed=marqueespeed/ ]+ v% x7 f( z9 J" K' e
var pausespeed=(pauseit==0)? copyspeed: 0
, U& M# t! D6 M" D: Yvar iedom=document.all||document.getElementById8 d) t3 w" ]8 t8 Y: q( W7 t, D
if (iedom)
4 L! s/ K$ E) _' q' Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) n/ l C2 L' x9 f0 u3 L, j
var actualwidth=''
3 r; G7 r! o9 j3 p/ W" Y1 rvar cross_marquee, ns_marquee
( \8 V1 E" W7 s$ G
3 i% z. y6 l+ n% U& |& h" ffunction populate(){+ M6 |4 ]% E, ]& f& Y) Q+ g: s
if (iedom){- P( p% ~9 h: b' m3 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 ?3 v1 {9 b/ Z- F* Rcross_marquee.style.left=marqueewidth+8
2 j* W% i6 ^) o0 a+ Xcross_marquee.innerHTML=marqueecontent
' v" y* Z' j, ~0 v8 ]) _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) D; R$ h0 z, G8 X4 v8 e
}
4 ^( t ~6 u6 A8 W. s$ belse if (document.layers){
2 m1 ?6 A. ]' k/ |4 o1 J: qns_marquee=document.ns_marquee.document.ns_marquee2
- R( V( D. R# x9 H) cns_marquee.left=marqueewidth+8, H. M& U' t1 [/ v+ F. x* o6 U
ns_marquee.document.write(marqueecontent)
3 ~& ~0 w, O6 X# jns_marquee.document.close()
3 H+ T: a: U2 eactualwidth=ns_marquee.document.width
# A0 Z8 L1 M' P& ]! Z}
6 n3 O; ~! {$ \; y. S7 t Z9 P3 zlefttime=setInterval("scrollmarquee()",20)
/ o8 C( u3 _, u3 o: M}; \) y, }, f( _9 i
window.onload=populate, ?) O! r. s! D8 K+ S
+ y" O6 c" ]3 z% F- l% x/ H
function scrollmarquee(){5 {7 P7 f" r4 I- D# h' F
if (iedom){" R6 ?! C$ `, O, T) M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- b# x# T- Y* a/ \/ Y8 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& `. V$ Y- P% l/ Z; h; }, belse4 p1 |2 X9 L% b9 V& h
cross_marquee.style.left=marqueewidth+85 } t& f6 p5 T1 O8 ~
! F3 s9 V# U# v
}, C. {8 `( }% {+ M
else if (document.layers){& [1 t! P& w9 F0 |! Q* u/ h
if (ns_marquee.left>(actualwidth*(-1)+8))8 L! @) Z: k5 _# j9 b- s$ z# K
ns_marquee.left-=copyspeed& H& C. H3 P$ Z! c+ @; q3 G
else
) S5 ^( n$ K( Cns_marquee.left=marqueewidth+8
0 Q& i, s: m% z}
6 f% o, c& l/ l/ ~ e}
: L' P4 E! G" L; ~
" a m) s6 l" }0 c4 f3 M/ K* Xif (iedom||document.layers){
8 H! P2 Q- j+ Bwith (document){$ H% H( C+ B# b. ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 S- T/ Z8 A3 C3 F! b" r* m _
if (iedom){+ \! |9 q. z7 {% K- F- Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 x6 i% {9 d$ Q; P! J" jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 ?3 f' W0 T* D- e2 twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* ]5 ]* K0 Z- M5 i( d3 x& k1 ^write('</div>') Z" r9 @% W' M
}5 n( q6 H- S( j+ H
else if (document.layers){
# @, O, v2 V0 ?6 Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& d% ^5 C5 ]; m# zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 i; j6 k9 `- W) V6 Q* f* @! k. J
write('</ilayer>')' F# V7 m5 o* U G
}
: F; w' l$ T% bdocument.write('</td></table>')# ~, M( k% p$ L T- l* h0 e
}
) f& f5 S# m. U _} k/ s" M* R' S2 P4 S$ c
</script> |
|