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

|
网页之跑马灯文字特效
//修改宽度
- y+ m3 [3 O% cvar marqueewidth=300/ `, V6 ^8 g! _ c
//高度
: b& j8 Y( s# z) \8 Xvar marqueeheight=259 x5 F2 n( c" j, L5 h
//速度(1-10)
" U( R& d2 Y, A+ Bvar marqueespeed=3
6 C( g+ U1 A2 ~1 Y' @3 V J5 p7 ^//背景颜色2 G {, c; a# G9 j
var marqueebgcolor="#FFFFFF"- P) h. O8 W# m7 c' M& M* }9 ]" ^
//是否能暂停 (0=no. 1=yes)?
- v- G& ~0 x5 y- Lvar pauseit=1, O( h9 q$ ]( ~4 I4 h" A
1 ?$ G i3 k1 S9 I) m/ H; K2 q
//修改显示内容% r1 Q& ^ P; B" ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' a! |/ N/ A, x z6 D) ~! @6 A: [) b- \
, K* B' o) r- q5 N5 |////下面不需改变////////////
7 V5 i1 f% E2 ~
, ]* I) }+ c! |; F2 M* A5 h; {var copyspeed=marqueespeed$ g, P' a( E7 p
var pausespeed=(pauseit==0)? copyspeed: 0% J; d' t1 Y2 Q) F. g3 S
var iedom=document.all||document.getElementById
& C' c4 S) Q5 K O2 ~; Zif (iedom)6 C7 W; c4 \" E8 Y5 a* Q+ O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' x$ V6 U+ B/ tvar actualwidth=''. B- M1 s' M) V; U2 @0 W1 R6 s) L
var cross_marquee, ns_marquee J* d$ t- x; `/ q R
8 ^1 J7 e/ S& J* h. L6 e9 R$ a
function populate(){
$ G% o7 y* L- s4 ~$ pif (iedom){1 T y0 H) q) Q: [6 a/ h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) r' B$ J4 O: q/ W$ C
cross_marquee.style.left=marqueewidth+81 \! V" o+ {' u7 {
cross_marquee.innerHTML=marqueecontent
6 R% b) X8 s7 |$ h4 v! factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) U4 D0 @* ?" y' r' F}* a- R4 d+ a5 `( U% D, `/ M
else if (document.layers){% r) ]' z3 d+ v" q7 d: q! Q, [
ns_marquee=document.ns_marquee.document.ns_marquee2
& h5 A$ |3 o. A: h3 H8 Uns_marquee.left=marqueewidth+82 ?! `7 L2 F6 V9 `+ a2 Z
ns_marquee.document.write(marqueecontent)
7 b% X: D; R) Q" |( Xns_marquee.document.close()) i. t2 B# i& D
actualwidth=ns_marquee.document.width
- R: |# q. g- M$ P& n6 r" j}
7 S7 J, e! x) e: d& G. k3 m) [lefttime=setInterval("scrollmarquee()",20)
; P$ R) Q" Y: ^2 }& z" Z}
0 l ` {) N* t& g- [8 K4 Bwindow.onload=populate
- n' _3 I% ?% Z7 C" R3 \+ S0 S! _. }0 O$ r* w8 r5 }7 \* H/ F
function scrollmarquee(){+ x4 u$ h4 T0 |% I% g6 z" `
if (iedom){
c0 }5 v. ?% X( y8 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 v/ U: w$ S T9 B. {% b2 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) o2 w- [( o K- lelse
4 ]6 f7 S% f$ Kcross_marquee.style.left=marqueewidth+8* [6 s) H# J0 }) d. t& h
# l) p# x2 v) D8 I6 X7 O}
3 w7 [; R& Q+ V1 S& pelse if (document.layers){6 G9 s* ?* O6 _% `: I6 w
if (ns_marquee.left>(actualwidth*(-1)+8)). V% Q0 ?% k: ?; a0 c. @. c
ns_marquee.left-=copyspeed
( n3 z- z E4 C0 y$ [ telse
# C8 |5 U$ u2 |" }# i: nns_marquee.left=marqueewidth+8
X# z! c0 D+ ~, r$ P}
+ L3 o# ?" w7 [4 X+ Q q: N}5 ?$ ?7 J$ p" u! L1 v/ _ s5 S
$ L: _& n( @* U. O) Uif (iedom||document.layers){
9 e3 E) B! J, Z% ?- vwith (document){% h) C$ T- l3 `4 v5 @) L5 |. Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 r) {- p. K: Y# X# u% ?if (iedom){1 _/ L- v7 V4 _3 q+ n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 ]4 e& R/ o$ W, Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" Q/ n# ]' k; k; d$ r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% F5 B% J( r1 i% p4 ?5 V# Dwrite('</div>')
, i& _0 R# X$ v}
3 U+ I2 x. `' u( i" f ?else if (document.layers){
O% o9 D9 P/ X/ H2 h! H( Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ O3 _1 W5 N, }0 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( y- A+ l; d6 s. `, f* Bwrite('</ilayer>')* Z# Q, a2 ^$ x$ d* w
}# g6 \# d/ n4 v6 T# V
document.write('</td></table>')
@% B$ v& A% h+ S, E3 ]( o1 L6 Q}
" F# P% g/ g0 t8 X- c( S}7 m- v, Z0 i: e [
</script> |
|