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

|
网页之跑马灯文字特效
//修改宽度
7 i+ y; ?' `1 `% q- J; m, {var marqueewidth=3003 r; [- E; f/ X, F
//高度/ n G6 C! t, a1 o8 I7 _
var marqueeheight=253 z2 k" A/ }' R$ b z8 }2 \% Y
//速度(1-10)
" c( y6 v% x+ L j, m$ Gvar marqueespeed=3/ n% C4 @+ H \5 F% L6 V) K
//背景颜色
# K8 S$ @# T( l1 z) pvar marqueebgcolor="#FFFFFF"
* r% j) r8 | u7 V//是否能暂停 (0=no. 1=yes)?
8 C% q* Z$ M; fvar pauseit=1- C& B% l% C m9 ]
( a9 s) o1 F, Q$ ~! Y& f- t
//修改显示内容
0 X! F3 u- K1 U" k2 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 C+ W1 h0 Z, _; b; x2 }. O: O( r
& x! p; ]' ~4 z- Y1 I4 Q- k
- N+ r5 C `9 d4 R////下面不需改变////////////6 P; x3 w8 p! S2 F" C
5 z% ?' V/ N8 g
var copyspeed=marqueespeed
& U8 d" {9 f( kvar pausespeed=(pauseit==0)? copyspeed: 0
: G' i- j' }; m0 c0 i+ t- bvar iedom=document.all||document.getElementById
6 y6 ?- h4 j) {% s" T' q& rif (iedom)+ X" a9 S; z: V+ x1 f9 S; Z+ w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 \( e2 v; v/ }' ^' o& l3 v- }4 Dvar actualwidth=''
- {' {8 |1 x, Svar cross_marquee, ns_marquee
5 ^! V4 e: r, r; S$ o) M" N' e2 y
2 i4 S- _2 [* R- C( P7 ^$ n+ Bfunction populate(){/ K5 H+ B- D ~# Z
if (iedom){
7 Y( ` Y b: D/ b' n" W. e; gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ x- _+ D6 {- Z7 b
cross_marquee.style.left=marqueewidth+8
5 R2 \$ d4 k" \6 Z5 l0 Kcross_marquee.innerHTML=marqueecontent0 Q7 _" W; Q1 @6 H* M* e" B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 z2 \3 `* |- O
}
( P+ [1 x4 A7 x% g1 }, ]else if (document.layers){; Y' {0 d$ d) X! b6 |
ns_marquee=document.ns_marquee.document.ns_marquee2% w" n- h3 B8 g( Z( P
ns_marquee.left=marqueewidth+8( N! M9 b5 e0 F. y3 C0 W; Q7 t
ns_marquee.document.write(marqueecontent)
4 ^! K4 j5 l4 ]0 Vns_marquee.document.close(); |- }( Q8 u1 P; K
actualwidth=ns_marquee.document.width* K7 q2 K1 {- [3 C% Y0 t
}) p; `# z4 Z8 ~% o
lefttime=setInterval("scrollmarquee()",20)
! e3 [6 L* Z) A% U0 ]}
7 g, N, p% R7 Twindow.onload=populate; X9 J- Q0 E4 k$ `4 m, x5 a
1 q0 ^$ i# N+ v; E% {6 afunction scrollmarquee(){
) F: `. { ?! @/ Z' F3 Sif (iedom){
* ^: o! D7 `- P* ?( _ K& m* fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& ^9 f1 ~" @9 S, I$ [* [( jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, d0 w- e) y! |4 S m' Q/ S1 Welse
5 n! I d' v4 A$ t9 ycross_marquee.style.left=marqueewidth+8
2 {" G2 P4 o( T* l
4 n6 ^5 H* B" J/ {}
; S8 b5 d) m4 U, T, d" Y: w' @- Delse if (document.layers){( r- N1 j x- R" M* c9 E5 ^# g; }% M
if (ns_marquee.left>(actualwidth*(-1)+8))
6 | ~8 I/ v2 R J$ R! {, Nns_marquee.left-=copyspeed
3 A3 N k1 w$ D. Eelse
3 U* a( K1 a- X* x7 L$ f7 F% \! Tns_marquee.left=marqueewidth+8
7 a, ~5 k! K9 _}$ C' G8 |1 v+ V1 n
}
$ V2 E6 c! [# ~$ q Y
( w/ A2 w" B( Z' g' Pif (iedom||document.layers){
: k. ] N# M4 Z1 {0 x# g+ [& ]with (document){( _& l: ]" O7 M' [5 H- ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' X+ @3 G. \( E5 U0 _3 c+ w, @& Z! Oif (iedom){
* x# {2 U' q! _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 R2 [- H4 e% F8 w0 Z( e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- d" ]( b0 t, ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 r8 ~# f1 r9 lwrite('</div>')/ T; L9 Y, _# [! O2 J, G8 V4 V3 ^
}7 D0 t7 B; m: M4 V& s, m
else if (document.layers){
5 ^! R) Z: F8 J" Y9 Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ S k6 U' }" k, m- q( l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' O3 b% X: Y% ewrite('</ilayer>')/ C3 d# y( [6 k7 u7 o* {
}
# z6 H7 j- K6 |( M& h1 q, tdocument.write('</td></table>')
) K* u1 ~: {8 h} l8 z8 ?2 T5 X' G! ` T* h' b( a
}7 ?( v6 t2 \: d2 ~3 }1 D- V# S) v
</script> |
|