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

|
网页之跑马灯文字特效
//修改宽度
: m' C: [5 l; z! A. O! O$ z/ yvar marqueewidth=300
4 w+ B8 v; i& A! Z0 \/ z5 |+ W//高度
5 A7 b' y4 O' g N) [1 vvar marqueeheight=256 [+ [: f+ A/ \
//速度(1-10)0 Z) f$ T# B2 n' ^. R( u
var marqueespeed=33 E% x1 P! g3 {! Z- Q% j! {8 H
//背景颜色
$ L& ^! s+ f4 |var marqueebgcolor="#FFFFFF"( o( ^( U; Y6 Q! Z- H& Y0 S
//是否能暂停 (0=no. 1=yes)?
5 E) i5 r3 p! R3 O7 Cvar pauseit=1) o0 D7 Q3 } c* N* m0 G* @( v
. y7 ?5 U8 f# M- X. r$ R8 g$ r//修改显示内容4 x' R) v9 z6 A6 }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ g% _1 j3 K6 C+ t7 B
3 q7 B) e- [* D2 g
8 Z7 v$ x' }0 _////下面不需改变////////////0 F' g1 ~# n& K% y
1 G% R9 d9 X0 [/ L2 I' f
var copyspeed=marqueespeed
+ {# q% n+ @( n4 ], ^# `var pausespeed=(pauseit==0)? copyspeed: 0
# [$ e! B* n" O/ u& f9 N; ivar iedom=document.all||document.getElementById
3 X. @4 ?* J: e$ Z) O7 f$ H$ wif (iedom)# L8 ^' l) L: h# y8 X% C8 z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ v2 e7 D4 c0 l7 a F
var actualwidth=''+ C8 h; g4 [' A" n: ?$ Z1 M
var cross_marquee, ns_marquee7 h5 }( L; b1 }$ N: E4 b
8 h$ G+ o1 H8 V1 @$ _2 ^+ vfunction populate(){- ^. N. {5 e0 v6 p" |
if (iedom){" ?& z5 g# Y; s2 R3 v4 }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 [8 e7 R) }4 n) n) D. ycross_marquee.style.left=marqueewidth+8
; u$ t& G- m5 L0 R. I ^cross_marquee.innerHTML=marqueecontent/ H# C' _- y3 E$ X) C( H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 f; [8 e0 y0 c1 r}, u% Q/ F; y4 H* r r Y
else if (document.layers){
' f7 e8 c+ S& L) h4 ins_marquee=document.ns_marquee.document.ns_marquee2
) h1 V# A" f0 \ns_marquee.left=marqueewidth+8% A1 L$ v* }& r
ns_marquee.document.write(marqueecontent)
( D8 @, M9 ~1 vns_marquee.document.close()
3 W) B) ]0 F: l6 iactualwidth=ns_marquee.document.width. ?% F3 I# ?0 ^6 w6 r
}
8 `3 @( s( h& alefttime=setInterval("scrollmarquee()",20)* \! C0 T$ U, L5 r) I
}$ V. j( x6 W* ^
window.onload=populate
~' y0 a# ?6 x j' [& D9 e f n" r
function scrollmarquee(){. A6 V: r0 J' s+ W3 d1 B$ Q
if (iedom){
( h+ T3 a$ H" N: |& d! S9 a2 e' V4 _7 Z( jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ Y* ?1 h4 C3 ]( zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: [1 o9 b: ~: B( [( Uelse5 b5 W) t( Y! P
cross_marquee.style.left=marqueewidth+8
. |4 Q: ~# e% Z) p/ s; o9 Y7 y. x+ o- g2 R
}4 t" b& D/ l( _0 Z
else if (document.layers){, c$ Z& p) l9 G
if (ns_marquee.left>(actualwidth*(-1)+8)): F. o& C% }5 X( m2 T
ns_marquee.left-=copyspeed
2 y2 O6 d3 _, Z3 U) ?else, n1 ~" L! i& `3 }( |2 L& E
ns_marquee.left=marqueewidth+8+ N) {: f& o4 F6 j9 f0 ?& k
}1 e) g# O( Y4 t- s2 M) d
}* x% r: V) H7 n7 _/ m6 l {
& G; X/ O( j0 e% S1 I8 @* J
if (iedom||document.layers){
/ k- ~ ?7 x5 L B! H+ P8 bwith (document){1 z* k# u! S1 W* Y& s9 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' [9 t- h9 P/ @4 ?
if (iedom){( M. E6 x. q* ~6 T$ e. v& M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 E: Y" E7 y C1 K9 ?1 E( nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 X% o/ @ I) ^6 r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) Z; M5 ~8 O$ U6 j, G9 v% N2 S
write('</div>')
. t2 |: T& t9 m}* x$ h9 R9 P9 R9 C4 k
else if (document.layers){
; s$ i" s. e, B3 ]* H3 G$ Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 |) s& [: W, y# J" e7 U7 Z ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ y$ V6 n* k" s( a4 R7 ewrite('</ilayer>'); M$ ~" E' V9 h2 b5 u0 {
}# s: u3 m5 J% H0 k- ~5 G; G/ Y
document.write('</td></table>')
( g) W2 e+ w6 q2 D}
( J+ K5 Z' B- C/ }}3 \, V y" C' @$ ^& {7 |# j
</script> |
|