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

|
网页之跑马灯文字特效
//修改宽度& z9 G3 F- R% M4 d7 }
var marqueewidth=300
6 [7 [% K/ F2 s( [//高度2 y D" J# c9 x% c% D( G* X, q, h
var marqueeheight=25
! W9 k: W) g+ X( J+ v8 a5 ]//速度(1-10)# l9 \3 ^, m. }. v9 z
var marqueespeed=3
, Y. o" n- R' X) R" j3 r//背景颜色
! l+ n1 l# W; m6 J9 I3 ]; ~( w4 S/ Dvar marqueebgcolor="#FFFFFF"& T% E4 d; q4 A$ ]/ U: d$ O7 h: k
//是否能暂停 (0=no. 1=yes)?" g5 \4 l, Y- W0 l4 ~3 @, S
var pauseit=11 ^* R4 _: o9 }+ z6 Q$ w
2 s+ f8 Q L6 H% T6 z, H9 J
//修改显示内容
; M! ?+ ?' o5 G: u# ]8 E/ xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' X8 O& {* f& h3 W! x7 F
# G, ]$ b! L6 e3 i$ X7 A ^0 V5 e
1 x8 D- i( D* u2 W////下面不需改变////////////5 c6 G4 g! ^2 w, ^' a9 v' q% K% ^( U
1 _4 E- _! F+ |3 u( o
var copyspeed=marqueespeed
' \1 B0 f* c" o9 d7 Pvar pausespeed=(pauseit==0)? copyspeed: 0; l: z9 k2 l8 n N" c
var iedom=document.all||document.getElementById- w) y# f; R3 b" i: d3 D3 H8 J
if (iedom)3 _7 S# H3 j M2 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 y- @1 C5 z* T) @var actualwidth=''
" m7 o" Y; z; L5 Cvar cross_marquee, ns_marquee/ A w- X% f& n7 O/ ]/ g: w
9 ~" a% A4 @. e9 n) a/ ~function populate(){# `! c3 X1 Y. n( D' }! f
if (iedom){3 `' e* u' `% A% k( ]. F0 |. x5 ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' R: F' U- _$ C+ Y5 e$ C
cross_marquee.style.left=marqueewidth+8
/ j3 ]+ A$ s% Q- _( @- q* Y# _cross_marquee.innerHTML=marqueecontent
9 y% |4 D9 m: ~+ G$ R3 r1 O6 J4 S* vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 w! R$ Z& |# E) ~1 I% {" z) @# e% E
}
' \5 P9 m3 n2 g) kelse if (document.layers){4 E2 B" y* T! z4 s8 p# ~# l: @
ns_marquee=document.ns_marquee.document.ns_marquee2: N) ?+ [- G- q& e3 T
ns_marquee.left=marqueewidth+8
/ D3 b) a. l7 Q) A- b$ c* j, Fns_marquee.document.write(marqueecontent)
6 E" t+ f/ J6 n# b- jns_marquee.document.close()
* V' \! S) k; {! S3 s/ d* Xactualwidth=ns_marquee.document.width8 m/ z0 R8 H3 Q9 G
}" v6 B( `$ x( f* t* \( o
lefttime=setInterval("scrollmarquee()",20)- m/ s6 c( m* a/ K" @" z
}- l5 |6 d$ i9 l2 ~4 M( o' G- o. ^
window.onload=populate
7 Y. D1 R- R+ h. ^, d: S& K$ y- J1 N8 k3 @# I% N
function scrollmarquee(){
; y; _4 M' j0 ?, u% Gif (iedom){/ N% Y) z$ k4 }+ z; x+ ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), l$ K% @+ p$ z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! M3 X0 N+ u# ]else# S- y2 F' Z9 C
cross_marquee.style.left=marqueewidth+83 C* N5 F$ o% G' d* D. T
& b; M G* `% @$ I
}
: J. Z7 e4 _& i- n/ H1 ]else if (document.layers){ `6 z+ S, Y7 f9 W7 S. p# q8 j
if (ns_marquee.left>(actualwidth*(-1)+8)); P6 [2 g3 J7 `9 w/ C! m& n' C
ns_marquee.left-=copyspeed; G4 u+ b$ t+ u' G2 i
else
# ?( ^! b2 x' Uns_marquee.left=marqueewidth+8/ Y5 k- e2 w7 Z/ O" s
}7 e& F2 ]; F# @4 J4 k; E) m( x
}
! V+ U/ N' X Y. T. I
" G- @9 o( H: I" D, `! nif (iedom||document.layers){
/ Y! y# \$ a5 {+ |with (document){ }. _: [4 ?/ ^- |3 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 `! \# S* G1 X) Q0 ?- |$ jif (iedom){1 M" t4 n" z C3 r2 a6 p0 V& E: Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" c9 q, b3 ]) l: D+ P" a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- ]( Y/ N4 x1 `9 f1 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): J# S/ ~" ^/ I6 w
write('</div>')
( A$ J4 w: _% r \+ i) O}1 |+ X+ r2 ^) E0 M3 q( e; D
else if (document.layers){
5 ^1 s- C/ ?2 I0 `! o: dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 E; n0 n6 o9 y P- O5 Z! fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') }* o( L' o' |8 L) W( t4 m
write('</ilayer>')" C( X# t0 }, J h
}* [$ Y5 A' z1 L0 t! @' q! d
document.write('</td></table>')
4 ? \% i( q4 G}
# l* a. k$ u8 O$ Q" y* e9 p9 ^}
7 j2 } O, n! o @8 F</script> |
|