返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 X0 c. i9 v( W
var marqueewidth=3008 }) a2 u& Z2 U6 U0 e; d: ?! g
//高度
: P/ p; A$ L& Z* R+ U# Uvar marqueeheight=25
# b' n6 _3 F7 @4 q9 z( _: r. l//速度(1-10); p, [. Q$ P; v  W
var marqueespeed=36 s9 l% q8 K( @; Q
//背景颜色+ n5 p* Z# K! G7 i
var marqueebgcolor="#FFFFFF"( i  J* w! F4 y: [) W/ Z' |9 x
//是否能暂停 (0=no. 1=yes)?
8 x: k& M* Z) }5 y5 jvar pauseit=1
1 Q# G7 c8 Y" w# Z! D- [5 g: v/ F! H2 @
//修改显示内容
" O1 }& L" R) R' H( s- |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' s/ k0 {( T1 _  U  k2 y
# I/ D- n  W0 w2 }
: b0 O6 i: n% K5 Z1 ]
////下面不需改变////////////
! B* z' r! t9 ]- S( N3 n
4 N  Z2 ~" T* Y9 s1 Yvar copyspeed=marqueespeed
& P1 y9 u8 h4 j) B. T' Pvar pausespeed=(pauseit==0)? copyspeed: 0) ]5 {5 \) x; H2 h! E! S. j- H/ J$ W
var iedom=document.all||document.getElementById7 W/ N1 O: \# J" D
if (iedom)
- W; W9 q+ w1 {3 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 c2 e4 d$ J# l! M; d
var actualwidth=''( V4 M4 c' M) @# Q$ m5 z
var cross_marquee, ns_marquee" X: {, o/ D- ^4 \
+ Q- S# i7 N0 A* }
function populate(){
+ D( C# i  p; e, L1 ?4 o8 O( iif (iedom){. D8 M+ ?- a* q; i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 z, }- M& w! I$ ?! ^: z
cross_marquee.style.left=marqueewidth+81 `% L8 _, O: F3 h& D3 o
cross_marquee.innerHTML=marqueecontent
, ^9 L: |9 x& }0 Z- w/ u% tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) }8 f/ A7 H% J6 A" Z}
. o" |+ N, C4 |else if (document.layers){
6 a! |0 \  E  S6 L/ |# x2 Jns_marquee=document.ns_marquee.document.ns_marquee2
3 {6 U4 M$ W; Q( C& Pns_marquee.left=marqueewidth+8: w8 G0 b1 D0 @! ^6 H5 `
ns_marquee.document.write(marqueecontent), {0 [3 m2 G( Q! @  F
ns_marquee.document.close()/ O/ Z- _5 i' J& @
actualwidth=ns_marquee.document.width: ?; F7 X5 s6 I. ?# K
}
; @" V  Q* z  Nlefttime=setInterval("scrollmarquee()",20)% N, Z$ X$ A/ V* X% C# t
}2 I( r, t# W3 U  h0 G, a$ I
window.onload=populate
! `- l6 `# e4 u+ n1 V
4 H8 U5 ]+ K/ X. rfunction scrollmarquee(){+ C! v- R9 @/ O1 w
if (iedom){
; B7 _8 l  ~: H3 i0 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 ^; Y( ]4 W! `, {% u. ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ G' N$ Q' S. a; F7 Z6 jelse
# g) P7 j$ d, k+ [9 ccross_marquee.style.left=marqueewidth+8: f/ q3 ?" ~) }6 N

0 i* b( A6 W+ x9 P% \( Y7 u}9 K( ^% R; G" _, I$ _+ ~1 a, I
else if (document.layers){
) q0 t, }, F1 R) ], P) `) iif (ns_marquee.left>(actualwidth*(-1)+8))
8 x9 \9 O' ~3 P7 w1 K6 Ens_marquee.left-=copyspeed& e* F5 b3 k+ j, d" e' m5 H& E
else
, V* j7 p7 u" B. u% i' g  y: zns_marquee.left=marqueewidth+87 t1 @) i; }4 a( v- p- {' |
}+ C7 `: L; M1 U, n5 Y8 ~
}6 Y( w; H! t; I, K, t% i3 x3 ]
  ~. T) M$ B+ |: J( _" S
if (iedom||document.layers){
0 O" g) |0 f+ D) n7 C1 Gwith (document){
- V% K( w! o. \, Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 z" o( \- y* S5 g) ]
if (iedom){
% }5 n% q/ M( |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ a+ S: n5 @; I# `! hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ a4 _; i0 x- R% R+ g0 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ f9 m  Z0 K$ H
write('</div>')
# b" W, I* t+ r" c) y; m! T; e5 o}
. d: ~( u0 z" a1 Oelse if (document.layers){
/ Q% I) T! B" v. |2 T4 H- Z. Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): b' I5 Y  W" u1 |+ e5 m. T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& S( f, n6 j8 Y  N* Y; C9 F
write('</ilayer>')
. C+ q5 \* k0 H}% t, f+ [1 ?3 [
document.write('</td></table>')
9 M8 D* n4 N, W+ Z}0 [8 D) m. ~+ I
}" f( g5 r' C, E$ n% d# R
</script>

返回列表
【捌玖网络】已经运行: