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

|
网页之跑马灯文字特效
//修改宽度
0 D: W% E3 P2 Kvar marqueewidth=300; w7 a; a0 v" t3 | Z
//高度" q1 Z5 I& e/ h
var marqueeheight=25/ Z; v. I/ Q) l6 v9 z: x
//速度(1-10)
+ f( _& F3 T3 f Y# T* X! j! Jvar marqueespeed=3: S' w% I+ n, H1 Y0 z* k/ R
//背景颜色" w4 x2 g5 h3 q/ ~0 Z, H' p4 @& @/ o
var marqueebgcolor="#FFFFFF"
) Q% m4 k+ U0 y//是否能暂停 (0=no. 1=yes)?
( U! f8 ^6 j# x* `: j! W5 q+ u4 c5 O: jvar pauseit=11 {. u" B, F; Y# m# a1 H, Z
6 p C. S( s, K0 K: u3 s//修改显示内容2 o0 s, u O1 T, U8 m; k2 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- w0 u% I% @. h" O v
* e, q6 ]4 e5 N- e/ h" O
+ K }4 M4 Z, J////下面不需改变////////////
, J- R5 v. p: W1 R8 B/ [3 _ C& X
+ s ]+ `" V2 @' S$ Z+ d+ cvar copyspeed=marqueespeed9 Q2 T& J* T' u
var pausespeed=(pauseit==0)? copyspeed: 0. E- j4 Z" Y2 a9 n# b9 L! F2 Q% ~
var iedom=document.all||document.getElementById# s, D8 d6 t$ x+ }; _, D
if (iedom)- |; R0 F! ^0 {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( w2 A! s' r7 j1 N
var actualwidth=''! _! Q/ N2 B/ C# e7 S. |* h
var cross_marquee, ns_marquee
/ U; L% {9 ^+ h Z; B; ~, p
2 }1 O+ v* f _9 Q. Lfunction populate(){
! G) I* @6 m2 k! u! Y6 }, Hif (iedom){
6 p! Y" M3 @0 Y! j3 m; Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ e" M' X# ~: t7 Z; _2 ^% c, F
cross_marquee.style.left=marqueewidth+8' b ^( E8 d# C, D4 i ~8 `' c
cross_marquee.innerHTML=marqueecontent
2 N' V, a. x2 G8 S+ \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# g7 I) L1 y4 j}
8 d7 d4 Q3 w, \1 B% T2 Belse if (document.layers){6 P7 o* O6 H, o; n& A
ns_marquee=document.ns_marquee.document.ns_marquee2
! X4 {) R, ?* w8 U& Q) gns_marquee.left=marqueewidth+8- }1 \; Q5 N; l
ns_marquee.document.write(marqueecontent)
, k9 C3 \/ L( qns_marquee.document.close()
$ }/ D: d G8 f: \actualwidth=ns_marquee.document.width/ K' ^6 f; G7 T. X. ^
}5 b0 z8 H, X8 i" ]
lefttime=setInterval("scrollmarquee()",20); }4 ]3 k1 ~) m( B2 q* V" a
}2 z' C0 Y" P2 C) e& L
window.onload=populate
4 a. P8 G/ _& Q% T% d3 }* Y- P; }$ N0 U
function scrollmarquee(){
" c( b. X( s$ @3 Pif (iedom){
# h* F! Q! f; Q* G) Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# }$ _* T. I1 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 Q B. d2 t: z
else, A8 W6 U7 n0 F5 P" T+ w/ r
cross_marquee.style.left=marqueewidth+82 U6 t( \1 S# T) W& V3 M6 T3 Q8 T
4 q* ^' w/ r) o5 v* _) h+ F
}
8 }$ I" [0 n: t5 c/ P" Aelse if (document.layers){
. j0 z- ]5 J. t- Lif (ns_marquee.left>(actualwidth*(-1)+8))1 N$ o `& l% [1 r0 a: S
ns_marquee.left-=copyspeed
2 K; Z2 g, }9 t2 B( }else8 w# g8 ^! N6 v
ns_marquee.left=marqueewidth+88 m! D6 ]! a) Y+ p+ e$ |
}
7 \5 Y/ `/ g1 @. w: ]; K/ U1 `}
8 S; t) g8 j( |: u6 d2 W6 f7 O0 N3 y0 y/ n. c* b( X
if (iedom||document.layers){
' B# j% J( w2 l: p0 Q1 p4 Rwith (document){
- T" d( V; X1 V; K/ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 A- A# @; G; l- T
if (iedom){
- Z, H& \" [4 y# K* vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 [$ p8 q% l: Q+ [, q7 |" ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) H7 G, D" W5 Y5 s) Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 J9 H' E# |3 V
write('</div>')" J7 a/ B1 n) G0 i2 S# ]- f- F
}
& T, R0 n- \1 F ?* ^3 e0 x1 Jelse if (document.layers){5 y' j$ R6 v+ h; {$ l& T$ E3 f/ `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 i+ f4 \, C" u+ R6 w* D; ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 q$ F- e$ O& V$ nwrite('</ilayer>')3 G' g( c* K# k9 ^7 V' H
}; ?( s8 E3 X* Q2 m* g9 ^
document.write('</td></table>')5 e: R+ o9 [* Q9 n6 W
}) g$ r* |/ p. O8 x; S: X: q" O, h
}! t* }8 Z$ X9 T% t# ^- L
</script> |
|