返回列表 发帖

网页之跑马灯文字特效

//修改宽度( ^6 Z0 I# H; G3 V8 v1 O+ c+ {
var marqueewidth=300
/ `9 g* Q! L3 G3 g0 x+ u//高度1 c; t/ I- Q$ \, ?  B
var marqueeheight=252 ~' b* k# e3 `! Q/ X. n  N
//速度(1-10)! v. b! d: s- Q1 W
var marqueespeed=3
$ d" n, Q: H2 O4 q//背景颜色
4 u$ k$ U) R( @/ `# B( o% rvar marqueebgcolor="#FFFFFF"! [, E8 w2 G  @: ~6 d& i
//是否能暂停 (0=no. 1=yes)?
1 ?6 e" B, `0 P5 N2 Svar pauseit=13 K4 N/ Q( v6 O" H8 j

# a, C& D. U, i//修改显示内容
; Y, k8 J* k, Q" C% ]" ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 i0 R  p7 g. ^
: T' D5 E" |! C2 b8 s+ W
6 i, K4 i5 Q. J
////下面不需改变////////////
! _: X4 d; A" q2 X% l- W* \6 T/ Q
var copyspeed=marqueespeed
. u" _" r- T; m3 Avar pausespeed=(pauseit==0)? copyspeed: 0
5 s3 M7 u& ]" Bvar iedom=document.all||document.getElementById
8 x" S: d7 U: E7 u( ?" ?if (iedom)8 a0 h8 ]/ u4 T$ G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* F! s1 Y- M. g; Y' Zvar actualwidth=''
8 a8 a1 v# k% J0 c3 Y8 [var cross_marquee, ns_marquee6 x9 L# L; J  E1 {. m/ A; }7 i
& m; ]. ]9 i) i( z
function populate(){( S3 K6 m) T; e  Y" P6 ~  m+ U
if (iedom){
3 B+ Z! i" T: d; q. q" g- ^) ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. h- ?1 I' m& Z) p/ q8 d
cross_marquee.style.left=marqueewidth+8$ L+ L/ k& _0 A' d6 {) e' C
cross_marquee.innerHTML=marqueecontent; h0 G; N8 M5 ^7 d) U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ _( m4 Q, ]1 T
}
# x3 r. `% k  [5 Z' ?/ \0 ~. ielse if (document.layers){* `. e$ e, Q* O: D3 @3 b, w
ns_marquee=document.ns_marquee.document.ns_marquee2! Q$ G" p% _$ A( n. T, M
ns_marquee.left=marqueewidth+8/ x/ J% ~7 h9 U3 S
ns_marquee.document.write(marqueecontent)3 M% e  G3 V! `% z8 F
ns_marquee.document.close()7 g% K) b9 N2 V! b' n3 a
actualwidth=ns_marquee.document.width2 v3 j* G& L8 U( V1 c: Y3 s( ?5 l
}
% E6 Y3 e( P/ v2 @' Z# X9 Elefttime=setInterval("scrollmarquee()",20)+ t. J( m4 {+ T4 J; A* @9 p
}
4 m; l0 A' |$ [0 `0 x. R8 Swindow.onload=populate5 I/ @1 L, ~+ |: G

! B! l2 n2 u% j( a( Q1 i1 A$ @: rfunction scrollmarquee(){  }2 A5 I' G, w5 x& _/ D; }
if (iedom){
& ?4 \) d  P1 R% c/ k0 iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& p$ U" ]- g( f: ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! m. B$ z, ~4 g/ j. belse2 I' E; B3 H/ A+ Z. s7 U% M
cross_marquee.style.left=marqueewidth+8, w0 l" ~& w; I) M0 M8 ~3 C, f

. G- r! {5 j' e; K5 a9 @2 q}
% k+ T' W2 }8 l8 ^else if (document.layers){6 f' n  L/ ~# A, e: |% R! L5 }
if (ns_marquee.left>(actualwidth*(-1)+8))) ?% q. `0 |, A2 i% z/ R
ns_marquee.left-=copyspeed0 `0 e' D& x* `, G
else
. I( O" ^9 b" xns_marquee.left=marqueewidth+86 u. _0 h" i6 Y
}
" B: @6 E  ]7 _/ J}8 X+ ]3 j5 a- V  [: K

/ w% Z- s, ?# S: s+ \if (iedom||document.layers){
! B& q3 m3 l+ h- Iwith (document){
( b7 N$ E. {7 bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 @! [! Y- S+ s( d% M( }/ t' Q, sif (iedom){" r0 e$ P6 Y& i' D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 M$ @  e0 {9 ?8 A( zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# ~9 X, \# P. o" L5 qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) B" P* q/ R3 @! z  T( H
write('</div>'); s% m$ L) N% }' P. w  s( X
}6 m5 E6 y' T4 I6 V- N$ f, g
else if (document.layers){
. M) ?1 v# I' w! I& e9 }$ \& Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  E! c! n) k, K9 R& P$ b9 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ [  K3 J' w4 T; \write('</ilayer>')
5 ?$ h% j3 r, |' t! [, r}  R7 X- n* I' E7 u- E6 I0 p6 @+ A- U
document.write('</td></table>')# o2 i7 J9 E0 P4 `. P. k! |
}
) U) e4 D# g* ~8 B0 z8 N}* p$ j# h  u0 S1 G. O
</script>

返回列表
【捌玖网络】已经运行: