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

|
网页之跑马灯文字特效
//修改宽度
8 o" A3 t- h h/ j! {var marqueewidth=300+ p5 c3 k4 G: X4 a1 c* `
//高度
4 R1 i, m2 b6 ?8 L* Xvar marqueeheight=250 g8 D3 c. a& a" m
//速度(1-10)
4 j9 U, P5 I: M9 u9 A' u! R! Evar marqueespeed=3
! ~5 V: @6 V {. {! \* p. k8 z- l//背景颜色 B: X3 b a* k6 r1 v7 g/ O
var marqueebgcolor="#FFFFFF"
7 T8 Z+ ]: }6 n& }: m3 @//是否能暂停 (0=no. 1=yes)?
- ^& @4 {" _0 p+ Q( ~) z& ^# uvar pauseit=1
9 `8 Y1 Y4 p7 k2 w: Y" K$ n8 X+ B. J+ J. ^
//修改显示内容8 B8 x# S5 w$ B- u5 x w- d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' T* B$ g% U. O
$ u: I" r0 H4 \( a T! R2 e1 r2 L! z! K) Z5 `$ o( s# h
////下面不需改变////////////7 \- K! p$ A: c- b: }
Q' y& y9 B: Y+ Kvar copyspeed=marqueespeed0 _% ^! ~ V+ h5 n* Q( l" q
var pausespeed=(pauseit==0)? copyspeed: 0
6 Z- S2 _2 V* R Uvar iedom=document.all||document.getElementById
7 l8 m& X) z2 t+ Q8 gif (iedom)" z, B* T* O3 k" V9 S& E6 c2 i. }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ y. f- u/ V1 t, z- F- c; H( Bvar actualwidth=''
" r/ f3 Z! V( ^! yvar cross_marquee, ns_marquee
/ ~. O, _0 M) m% |' ^+ l1 ?! N5 c+ q! z4 P
function populate(){
- c' g( t* u0 d$ n5 a: x1 C2 nif (iedom){, Y- `$ A( |5 H1 w9 c3 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& k2 H# T0 s- ]) z& E6 xcross_marquee.style.left=marqueewidth+85 @9 x- r) N9 y1 K
cross_marquee.innerHTML=marqueecontent( r2 d' H( I- l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 b8 N8 W; ? L9 X8 ~5 O! p- n1 n% Q
}
- Y+ ^, z$ n9 ^, h/ Qelse if (document.layers){" y: J% r8 f- Q
ns_marquee=document.ns_marquee.document.ns_marquee2
: n5 J8 S/ o+ [, t1 ~ns_marquee.left=marqueewidth+86 ~" U# ~6 E+ l: P% y9 ]2 M
ns_marquee.document.write(marqueecontent)8 C& q; l& V7 n
ns_marquee.document.close()4 Y5 m% w7 {' w9 \5 l+ t7 |5 C
actualwidth=ns_marquee.document.width) I+ L; `$ V6 h7 E% Y3 k
}' a! t2 ^( y; F) r l6 L. J/ v
lefttime=setInterval("scrollmarquee()",20)# f* Z. j+ f. s: \
}
& }- a9 f7 ?/ U2 kwindow.onload=populate
, {* s# |: n* q* }
7 U" S/ q5 y ^function scrollmarquee(){5 K7 M, B3 D/ d( t! I5 i
if (iedom){! c# S: b C( E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 p9 a; m+ c/ a5 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 s# { w# q d V1 S7 c4 k. p( celse, C. }, ~2 x3 ~
cross_marquee.style.left=marqueewidth+8
, T" o2 \$ Y3 ?5 U0 o7 c( F/ a$ V9 o% |. K O
}
" @( T- B f# q& f1 {else if (document.layers){
7 o: c- v+ Z) J2 cif (ns_marquee.left>(actualwidth*(-1)+8))
5 F# E: c; X6 yns_marquee.left-=copyspeed
`( n; x9 W& E) {6 G; Belse4 X" d- _. G; p. n/ @8 i5 k' r
ns_marquee.left=marqueewidth+8
* A7 S! Q# H& m, {5 J9 g}
. J) X( J9 ?5 a$ S}
$ w8 [4 u, U" t- ~4 c8 F9 T: T1 v9 T3 n. M4 _! F
if (iedom||document.layers){
* ]5 X: j/ |5 u0 C! c! zwith (document){
: W l. i8 N$ X) \/ Y2 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% G) D8 F# `$ b# i
if (iedom){8 M2 V9 r' ~- `3 T# [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: i( @: s5 [* i3 |4 bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 R% O( U; J$ N- A1 v; Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 H* X/ n( [ N( [4 Pwrite('</div>')
6 f7 f" ~ t& Q& a}
9 x* O. _5 G, C, z8 W$ J8 S9 {else if (document.layers){5 Y2 j$ ~. B9 K$ {" S# n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 G, D/ y( {% j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' P: [/ o/ d8 p5 Y* F( [, D
write('</ilayer>')! M3 Y( p$ N/ |0 S: _ Q
}$ M) [1 t. }, G7 j) z& ~: \
document.write('</td></table>')( K$ ]7 M5 }; B F6 c: b3 W( D
}
1 A/ Z, |' {$ W9 w) k6 i: R}/ O& r; s m0 v( t5 z- l
</script> |
|