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

|
网页之跑马灯文字特效
//修改宽度$ Q9 {9 ?$ q6 J1 M. C
var marqueewidth=300$ { b T( E2 |, P/ C) K
//高度3 }9 w4 ]0 T* O" t
var marqueeheight=25
8 f# j. C& n9 C* O//速度(1-10)% @1 {" u; [: L
var marqueespeed=3
5 m) K! Z( p! e, N" R//背景颜色
( D4 W: E& H" f: Vvar marqueebgcolor="#FFFFFF"+ ]5 R$ A) k4 ?/ [$ x
//是否能暂停 (0=no. 1=yes)?$ W; p6 g5 ~; l& L
var pauseit=1
* x r X7 ` _
( i! r& T5 @1 a& c% F% [2 ?//修改显示内容
4 e9 c9 q4 F8 y l$ G' Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' O! Q6 V: C& r1 t2 j* p
; `: ^, y. T% Y- F. X3 L
4 T1 b& C9 S/ o0 n+ {////下面不需改变//////////// X* W& j; A3 y: p8 m1 x6 H5 _
! V8 ?3 o2 \* l2 ]$ \
var copyspeed=marqueespeed
: H3 g1 W \: i- f* w% M3 \var pausespeed=(pauseit==0)? copyspeed: 02 D: N7 [# m8 s1 s7 a o1 k: j; J
var iedom=document.all||document.getElementById
- C1 h( G' R( g5 y0 wif (iedom)( R: {1 V/ _& s9 B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ ~- O) A3 O& H( Q" Q2 B
var actualwidth='') ]7 \' C: l% l4 v! V
var cross_marquee, ns_marquee
8 z+ q. j' b( D% A* o1 \" J6 s' A3 H+ m# m& n ^" N- o# Y0 {
function populate(){7 A8 W( W q1 n- j( u( @ e
if (iedom){
$ t5 R4 ]( A( L a: _, n( zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% S3 J& V- _2 f) [% Ecross_marquee.style.left=marqueewidth+8
6 D9 h* k* i! t# @- ?cross_marquee.innerHTML=marqueecontent! [2 h# H1 r9 P' ^/ v% r8 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- P& z% c- V# j2 R+ _, S
}
8 H$ }' [# Q8 c4 a0 }else if (document.layers){# Z0 f' N5 a7 H. D/ ~
ns_marquee=document.ns_marquee.document.ns_marquee23 z( S2 o8 Z8 c/ w$ L
ns_marquee.left=marqueewidth+8, D: m. r; h5 s1 k1 Q! P# r
ns_marquee.document.write(marqueecontent)
7 C2 U S: l9 V% S9 Tns_marquee.document.close()
* N/ o0 r9 K, t1 K) a# H9 b5 s" Sactualwidth=ns_marquee.document.width8 C P) `' K0 C. x/ I# ?) i7 v" v
}+ x5 Y; `3 [8 N4 @; l# {- p
lefttime=setInterval("scrollmarquee()",20)
M- t8 D# l2 s7 a" a}" `+ ]& I: K; C' @9 m2 h& l! W
window.onload=populate
! p6 z0 t" X! r [$ p! |* R1 [( M6 m" {
4 j( m2 g; E3 g9 p. H+ Tfunction scrollmarquee(){$ I/ ^5 a' i( {" m; ~* `$ E$ s
if (iedom){: x8 ?) W% {- [1 u( r8 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ |( e0 }3 j" r0 W5 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% b# x" }1 l/ y, j+ k
else& v# f3 O% x1 E) N
cross_marquee.style.left=marqueewidth+8- V8 G9 S8 G z( |) \
@0 [7 y4 i1 `9 @* R: d, v
}
1 p" C: d) w1 h, J6 E7 nelse if (document.layers){
3 a. ]# d/ U, ^5 D* m! ]: b; Y- ~if (ns_marquee.left>(actualwidth*(-1)+8))' J8 z7 T& J: y& F! a! _: g
ns_marquee.left-=copyspeed9 [2 C1 ]( }& a4 M! c
else9 j6 ~7 v; i8 u: E
ns_marquee.left=marqueewidth+8
* \0 u! Z. x x}
" g: E' R3 Y, J, p' y7 K# o}
# j: C. ]: C6 c0 V1 r2 c: v7 o7 p
if (iedom||document.layers){
* h, h' Z0 v+ t$ Xwith (document){
, a: @! N5 S9 i( V R3 wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! @: ~5 G( Z* {! Aif (iedom){' k1 g2 ]* b" T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! I, i* D0 ]8 Y8 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! e/ R6 Y* d/ Z1 t* swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- W4 r7 V$ }1 E# g0 M
write('</div>')" r6 T5 N2 a- t I; H9 B
}7 [, J5 |; o& W, D
else if (document.layers){# W, T, Z) g' R' H& ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 @0 K5 r4 Y& s" F' Z& J* Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& G) n0 g4 F7 Y3 p$ L' X0 j' iwrite('</ilayer>')
, D2 N" _/ N+ H8 u}+ U, ]) {2 M5 R( W
document.write('</td></table>')
/ D$ e: q+ r( C3 ]5 F}
9 C% Y1 C4 F' X1 @8 L5 ]' o0 D) w}( l$ @; ]. I% c4 B% z+ U
</script> |
|