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

|
网页之跑马灯文字特效
//修改宽度2 \/ O0 j1 V7 [9 e4 |5 K
var marqueewidth=300
' ?. U% R6 W2 w3 l8 K* W$ ]//高度
5 u& h8 K+ d& ~- Z, l) ~5 z& Vvar marqueeheight=25 s7 C2 \" ]& Q; c
//速度(1-10)
7 o! `* o- u5 X$ h/ {, g8 J' c/ U; e; v; yvar marqueespeed=3
4 h' l) c' W0 t, ~1 O( k//背景颜色
9 ~$ F$ f/ V* t* K4 yvar marqueebgcolor="#FFFFFF": X7 @( b& I9 L2 P) P8 t2 o
//是否能暂停 (0=no. 1=yes)?
3 L7 k- ?! u. F# M9 D/ |var pauseit=1
. q3 }' @5 i3 C: p f6 K: b
4 {5 g# k6 n0 m* U8 v+ S. q//修改显示内容; [6 a5 Y" A: ^. C, J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: n1 i7 T' a: ]8 @" M" |, F5 _# W b' T
; A. A! ^' N5 ?) Z////下面不需改变////////////& D5 A/ T$ j' N5 } k/ v y! E0 |5 t
# ~. C- u( K8 t/ H4 {* v8 U
var copyspeed=marqueespeed* e# q( }7 n$ ]- @, A
var pausespeed=(pauseit==0)? copyspeed: 0
- _: m1 B7 }; x$ Ivar iedom=document.all||document.getElementById4 Y- h8 l- C. y+ k9 d* D
if (iedom)& L* M/ J9 s8 b# U$ R1 M" S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). B* ?& R8 }8 Y" H7 t0 K: h: b
var actualwidth=''* u1 y6 L0 m/ P, x, Y6 e4 B
var cross_marquee, ns_marquee- D) D# ]- i8 {" b& v1 a4 `- p
* P4 o' |4 m v3 K6 `function populate(){& ?; [4 c/ G; A% R N1 r
if (iedom){
9 s4 |# |' W! @2 o: tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ ] j, N! [: b' L
cross_marquee.style.left=marqueewidth+8& U: A. v6 Q2 S$ q' ^# _ H% [
cross_marquee.innerHTML=marqueecontent
4 k6 `7 `. ]5 I6 b# cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% B+ Z! @+ z# B" c
}. }* U/ e4 {5 p. x3 g& _: _: I# ]: t
else if (document.layers){% O! B5 O1 M c
ns_marquee=document.ns_marquee.document.ns_marquee2
) G, ]! m6 O9 v H) h' }9 _ns_marquee.left=marqueewidth+8 b @" n' k- S8 x* T% o
ns_marquee.document.write(marqueecontent)
- l7 P2 r3 i" R: _; e" x+ Hns_marquee.document.close()
1 @7 G2 e4 B1 e% ]& i6 bactualwidth=ns_marquee.document.width/ u/ z# O% j$ y7 Z+ q5 j
}
# j& s7 m5 R, G5 j9 S4 d; }" mlefttime=setInterval("scrollmarquee()",20)2 d0 A: H5 m$ y, M+ p/ E+ i1 \7 ]: b
}" j$ u+ ]1 @1 X% o/ G: D5 E1 t9 x
window.onload=populate
7 Q) p% G4 |* @1 _7 p3 T3 L
& N, r1 Y9 C: b, D+ i' Hfunction scrollmarquee(){
, f2 h X# A9 H" u! c2 m; kif (iedom){& M% s7 S: i7 L, }2 w% j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; P5 F o$ l5 v fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- v% Y& G$ |6 o
else1 M0 F( _. }+ \6 s0 y- `
cross_marquee.style.left=marqueewidth+8
6 R$ D& @1 O/ t
5 d# L8 ^5 B4 C}
6 p& J/ V' ?4 q) L4 \2 Welse if (document.layers){7 z2 w7 J4 w4 O# G0 c) P3 S0 z2 e
if (ns_marquee.left>(actualwidth*(-1)+8))& c+ g8 }% Y- a* c' f7 r1 K
ns_marquee.left-=copyspeed
1 r; W. K3 X' r: F i5 xelse
& h, [9 c8 r4 _5 d, nns_marquee.left=marqueewidth+8% x1 s* o& m3 t3 c4 c& f
}( _: G/ X9 b& I& _
}
* ~, Z; Q" t1 k; m0 |/ S; i0 V1 H4 P$ I5 X
if (iedom||document.layers){+ r8 r% t8 r& P" o
with (document){
& r( P- S0 Z" D! S& Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, c! y+ ]/ I& z( |' e. w8 vif (iedom){
4 m; G! D# v/ c+ h1 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 x. a6 D8 G5 s" W8 b& dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* t0 O7 M% W) w/ _: e7 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 i7 v1 h3 n- b# s+ `8 \9 Vwrite('</div>'): l/ p1 ` y0 [1 d+ q: x
}
2 O. q7 p9 }- ~% felse if (document.layers){: c/ e' P! f. V8 P' B$ L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' t2 y% d2 S: ?3 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 n2 v0 I6 U! l$ ?# lwrite('</ilayer>')
8 | l4 b8 }# p. F9 {* |}6 f* W; ~2 }7 S3 Q( L0 t
document.write('</td></table>')7 B/ B9 d+ }4 K) J
}
. Z( S6 \* n- h. M9 i+ W}
$ L4 z3 T- v$ E0 f/ \</script> |
|