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

|
网页之跑马灯文字特效
//修改宽度6 z N- R: o& }! J j* B
var marqueewidth=300! S! j' v; R+ H+ T# b
//高度$ }/ V s; p# h; ]' Z
var marqueeheight=25
5 |7 t5 w d# F4 X; W//速度(1-10)
- R; W; `4 j7 p; o4 a; hvar marqueespeed=3
' s2 W* q6 _* a//背景颜色; ? G4 M* o1 ?; }6 |. [/ `" [
var marqueebgcolor="#FFFFFF"& N6 z C& i8 x6 r% d
//是否能暂停 (0=no. 1=yes)?8 Y) O' {* H, S) v9 D! e2 k: G! V
var pauseit=14 t: [6 G- H3 `
4 z$ Z+ Z2 g& r//修改显示内容( T2 i4 L, R4 X. C1 N7 g5 s% `# b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# N, S( x& L% b( A. }% h B& \
$ i% O9 M# p! a9 [+ Z: T/ Z+ T
6 ^5 y$ y. p! N1 Z9 t" F! \////下面不需改变////////////
) T' E" l, E7 l: i3 e$ C. P6 D# g5 C& z& P# N+ B- M0 H9 Y
var copyspeed=marqueespeed
) k4 o7 N2 C1 Fvar pausespeed=(pauseit==0)? copyspeed: 04 r* h; Z! n {3 ~; f; _8 i D+ Z
var iedom=document.all||document.getElementById
{; _0 q* H. w Xif (iedom)
, X0 u: |1 L, w' H7 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 N! m3 F4 ]7 T1 r3 x9 mvar actualwidth=''
$ m5 D$ ]! S/ ^: O9 j( A- |var cross_marquee, ns_marquee
7 {/ B3 k. H' q& W, V1 M8 ~ h$ ]2 k) K0 y4 {! P
function populate(){
& R L5 ?0 w+ n0 a& sif (iedom){- {* l. C; @3 A/ f( y' R* f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 |5 ]; S5 s! ?% Zcross_marquee.style.left=marqueewidth+8
2 M5 A$ U2 {! m5 X. Ncross_marquee.innerHTML=marqueecontent
( N/ ^' o& v8 H' Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 Y) N3 X2 U$ d
}
( [9 }8 A* Y, P3 _% Aelse if (document.layers){) G" K ]! @! t2 v8 ]9 y
ns_marquee=document.ns_marquee.document.ns_marquee2
* }; \1 p& Y) _5 E1 Q2 k& Wns_marquee.left=marqueewidth+8: M1 j% R" @" h3 Q8 J4 w
ns_marquee.document.write(marqueecontent)
: @% K6 d# |$ F$ s- h* X1 yns_marquee.document.close()* V- D5 t& A; e
actualwidth=ns_marquee.document.width9 r3 o) ]7 B# {4 h- C, `
}
, Y! m6 B8 A+ n* m+ Dlefttime=setInterval("scrollmarquee()",20): W9 O, ^1 e5 v4 d' Z9 ]% K
}: l/ f" }: O" A6 J4 b- ~! v8 `
window.onload=populate
4 l2 j. Q6 H4 ~. S; ~
1 |" q8 }$ L" A. ~! Y3 ^$ `# c/ cfunction scrollmarquee(){
1 Q. v* f" p9 R# ?/ y6 kif (iedom){; h* x" P u3 {% L6 ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 ~: ^9 @+ \. J2 c" j; x% e0 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 w( n, q: N2 `3 l/ Lelse
' Q8 V- _5 |/ N* a* Pcross_marquee.style.left=marqueewidth+8: L3 i j9 ~; {# r* U
+ N" s& p( B8 T [5 ^# U& Z) C z4 ^}6 X6 }' B7 d) r5 m
else if (document.layers){: V/ ^1 Q. ?$ i% S: u
if (ns_marquee.left>(actualwidth*(-1)+8))
0 d' B8 j5 }" t& ` Kns_marquee.left-=copyspeed
( {% a6 G5 W' ^0 A2 welse
+ d3 k+ b4 q5 Y# p5 u0 Kns_marquee.left=marqueewidth+8
; J( p) Z m% J}# T, B4 \0 i h5 ]
}
0 Y" v) l- z% t( Z# f5 e
5 M( N& a, r! S# q8 iif (iedom||document.layers){& b' Z" y6 T3 e3 B) S# v
with (document){ C* W" t1 t/ O6 F$ z$ \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' }; ]$ {' M$ N# {2 {- E$ f& A# Vif (iedom){# B# Y6 w' X- o: t+ b2 E2 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 K. o3 L U: h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 `6 J6 S N/ B2 ~& swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) w W V1 Z# q$ L4 |
write('</div>'); N. g4 u( |" B, ]: O$ {/ }0 ^) g
}% x- b1 E' o) d1 }4 }
else if (document.layers){
3 B9 ^( B7 ~/ y+ [2 b4 owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 Y3 X! ~$ D" k7 _) ~% A4 W# e( j# M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- T# P+ `5 L+ `% B4 S" r! Z2 }
write('</ilayer>')6 G4 ~2 w; W# g6 u. n* d6 a
}
! d/ t) |4 D* O# ^* Ydocument.write('</td></table>')4 y) m, w% W. t* ]1 @: ^: Y
}
f7 h. _4 O, b$ L}' h' S% d4 Z. m; B' t$ E- B9 P
</script> |
|