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

|
网页之跑马灯文字特效
//修改宽度
/ J2 n+ T* V% A: H! ]var marqueewidth=300- o; G7 s6 F, h" e+ A: x2 S0 V) _
//高度
- B: l" r7 G4 r6 Z8 _4 b! Dvar marqueeheight=259 L1 f: ]$ T R5 n( ^
//速度(1-10)
/ Q- i/ a. p' Y4 vvar marqueespeed=3) e" h5 a- y3 y5 c d; q+ n8 E
//背景颜色6 E/ G% E3 V( p6 L, ^
var marqueebgcolor="#FFFFFF"
7 N2 I/ P) T7 E' [$ O//是否能暂停 (0=no. 1=yes)?# D7 c# Y0 G0 S9 `/ e% r. _; a
var pauseit=1
8 W c- f" i. R* B9 A5 h, k% i! j+ T5 e: |
//修改显示内容 o2 B4 T9 x! `- D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 R4 O5 G, @; f7 l i8 X
5 X; g2 A B" s! Y# i3 }( r! g
# v' j6 f) p. i$ z3 o Q& _' w5 ]& D8 o////下面不需改变////////////8 r3 {! f* Q/ W- D, |
* z. |' y# q( ]+ C% F/ |4 a* U
var copyspeed=marqueespeed
/ R* s: W) \/ A$ l. t8 qvar pausespeed=(pauseit==0)? copyspeed: 05 A$ o2 M( b! S+ S9 i. }
var iedom=document.all||document.getElementById1 k+ m7 |2 K, P6 B3 i% g
if (iedom)
! {- m/ ~* G* }" | U$ O& Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): N: A! f9 |0 v+ ?
var actualwidth=''
0 t" Y3 x6 L" L8 W7 U# ^var cross_marquee, ns_marquee
+ Q9 c. m W5 Y" ?( [# x; o" M. J3 ]" v. x
function populate(){7 @9 w7 H/ b* c: O i
if (iedom){
! v$ a4 q0 g1 W- t5 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 `. G! r% P9 l5 q7 }5 h8 l: X
cross_marquee.style.left=marqueewidth+89 ?) S4 f" p; M. v. ^
cross_marquee.innerHTML=marqueecontent
0 R4 K* l! K4 b: v6 o; Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( f! `# `6 E6 n2 j8 _/ A' _}" D' _8 p8 m8 M' J8 ^3 h( g
else if (document.layers){) F2 d. z ?" @1 z. s/ y. E
ns_marquee=document.ns_marquee.document.ns_marquee2) Q2 }5 u! f5 @. y( ]9 P
ns_marquee.left=marqueewidth+8
' k8 c6 C0 s+ |4 W3 n) X! b$ ? g hns_marquee.document.write(marqueecontent)& [( M6 c4 a$ X- y* j
ns_marquee.document.close()0 D4 b& Q: U/ d' ~1 b
actualwidth=ns_marquee.document.width
* F- h; P5 l6 Y& z3 P& n2 H3 ^}9 }! v& X6 J u2 ~
lefttime=setInterval("scrollmarquee()",20)
) P/ D3 y5 I( N+ s# G0 b}
?6 o. A* O8 u* |window.onload=populate. C& @& I' s3 E8 ^; Q: z7 {% Y
6 q5 Y1 b t6 afunction scrollmarquee(){( l# v5 E0 G0 }4 ^, m
if (iedom){8 e( R; p+ k/ F, t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 k& z- e4 Y2 |3 V' Q9 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% B; Y; z4 H% y: ]1 ^1 {else
4 V2 g. ~, G3 D zcross_marquee.style.left=marqueewidth+8. n9 d% F3 Q' M# B4 T
0 x3 u) ?+ P# L; ]" i' {
}
" v" R$ }& f$ W6 f9 q# {2 Nelse if (document.layers){
; q) e1 f* B( e) Rif (ns_marquee.left>(actualwidth*(-1)+8))
/ i' l1 r. e* N9 w! ^. sns_marquee.left-=copyspeed
5 x2 S6 F; f, b. V8 p( Melse
6 r4 f9 k6 e# C$ sns_marquee.left=marqueewidth+8
1 x4 s$ { t5 ^$ J}
: V2 E8 S2 t; E# b}
, W! G0 x' P4 u9 V
) T& b: p1 M8 kif (iedom||document.layers){- p: B! x% j& u* b, b1 D% C, R
with (document){ u) {5 l& N+ K v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 m; t4 z E( X% e& Nif (iedom){
6 p1 o, I2 j& }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' B5 |; P h" t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- P$ Z4 Z3 p: H. s. S$ a4 M' _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% }- L8 N0 z) k% T+ l, J; k% i
write('</div>')
+ g+ b$ P- @ x, V# i8 k$ J}
8 Q5 V6 r6 s3 m# helse if (document.layers){" [1 P. D% D$ n' t: j% D$ n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 T' Q3 W" J* m: o6 \- wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- ~1 `5 ~+ V! L1 pwrite('</ilayer>')
$ S' V, e- U4 A0 L$ v}
% k; r) a3 e8 I: u% Ndocument.write('</td></table>')
. e g2 a* j1 N p- L. e4 D0 q}& w& E4 i& H3 g! Q
}$ g4 @" x L6 ^* `# L4 x) \. u( Q
</script> |
|