返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- @$ E8 }: J3 `, {2 t) h# ovar marqueewidth=300
3 a' Y4 }; `: Q( h//高度
1 M! h: o" K( v( nvar marqueeheight=257 I  a) l- }3 W4 @1 M  X0 N. K
//速度(1-10)+ p: t8 Z- [  f1 y8 \# Z
var marqueespeed=3
( t* Z. h: U: v% Z0 j$ a7 Q& O//背景颜色
8 F$ M  M- E2 q3 G2 `var marqueebgcolor="#FFFFFF"
3 O4 R  R6 ]) p; g, C1 a, `7 C& ^& ?5 ~//是否能暂停 (0=no. 1=yes)?5 d/ d7 ~3 n# x4 v% s
var pauseit=1
+ U1 X/ X# M3 L) _* J
( w5 v, d3 c" U( I4 _2 ~# z2 G//修改显示内容
& P0 F  b! l* R6 K1 Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" R% j2 X; z9 p8 M& o* S; S( ^; h5 M

- m. Z+ ~$ W: f2 Y, g& K! f5 Q. y8 Q5 ~$ {5 f5 ^& F
////下面不需改变////////////6 |* t( d/ M: P0 r2 C/ }4 h" |

/ t2 X, h3 |% Z/ F+ F- l2 lvar copyspeed=marqueespeed
  }1 s/ c( j4 P$ P4 x3 c5 Rvar pausespeed=(pauseit==0)? copyspeed: 0
1 K' v" S" [1 r: o9 Mvar iedom=document.all||document.getElementById; p! }/ A' \% {
if (iedom)9 L8 J5 C* k& b* W4 [# K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" ]! E  w& V. z# a
var actualwidth=''
+ L' Q2 g: v9 ]var cross_marquee, ns_marquee0 `9 n9 Q1 B0 e4 W6 y

( e  |- Y( C$ c2 p* Efunction populate(){. ?6 ?' a  @9 ~# W  j& a
if (iedom){) l* w; \# i& K) @) j6 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 W: x8 D  I' S+ B4 @. Gcross_marquee.style.left=marqueewidth+86 P7 O. o" x  Z5 M
cross_marquee.innerHTML=marqueecontent
2 W/ f8 ]  [5 k+ uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* B" f4 ]3 M0 P* X2 o3 Z) F) S& e
}
9 [0 w4 B: [2 M; J& _else if (document.layers){7 A% ~$ _5 w% d; |. q" ]# e
ns_marquee=document.ns_marquee.document.ns_marquee2
, L7 r/ e8 A( k% m& D7 Vns_marquee.left=marqueewidth+8. D  E$ @+ C7 V* F/ }+ f
ns_marquee.document.write(marqueecontent)$ _7 n  Z$ S6 v7 r4 s
ns_marquee.document.close()
, q2 |; H9 ~% k! }) b4 \actualwidth=ns_marquee.document.width
8 V) a' v; f4 o7 d}2 E  |7 a: z, Y% s
lefttime=setInterval("scrollmarquee()",20)" E. ^' F6 ?$ X0 e: b: a! ?
}- M. I: C( F$ C' X
window.onload=populate+ d0 \- T9 U0 u( t
% a& z' F  U+ q, i) J
function scrollmarquee(){
" i  o: v- V) b" T; Yif (iedom){
: E% z- H0 a. c# N: H- [  y& Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ^* z) g9 R" |- O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  f; J6 j3 }8 k8 p% P! V0 @else
( j/ y! D7 y. }/ W% @  C( R: Kcross_marquee.style.left=marqueewidth+8
( h) Y: `  f0 t8 b
1 Q+ K3 V9 N6 R- ?( m+ u}
6 k! B3 ?; J) belse if (document.layers){1 C! x# O" q# }% [' h3 b: u; j  _
if (ns_marquee.left>(actualwidth*(-1)+8))3 ~; H6 m8 D( {9 o+ |5 d
ns_marquee.left-=copyspeed
, h; ?3 W5 K+ O8 U" W' Welse
* O4 _) E8 I- O/ g$ N4 d6 {( n6 Ens_marquee.left=marqueewidth+8  p9 p- `! J  v9 r! z/ @  e6 M
}, `" _& W7 A  A0 w/ P! z) \6 V
}8 m9 h; v1 S& e8 a2 o

1 S( u" A. Z( o0 i* Sif (iedom||document.layers){
/ g3 o; x2 h3 J: C5 C9 b$ U0 Xwith (document){  W+ B) v* D' r" u# R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% d& [, Q7 [& l0 s$ |' q4 iif (iedom){0 v1 d5 o4 e5 C, N7 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- n% S8 `+ |* g& jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). N2 w) N7 v: A! B0 \- y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: {7 ~, E0 G9 G- {! s8 Lwrite('</div>')
& A6 H3 z; T7 ]1 k) c}
; k  Q2 c$ {% n: W8 |$ melse if (document.layers){
, t5 R6 b/ z' _8 U1 r: I/ ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), T5 }6 K. S- y! H* i8 K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ M* v1 a. u' j  |. Qwrite('</ilayer>')9 r  x1 b, ^1 L% J% t; @
}
) X+ R/ x/ H2 @4 o6 Z" m3 {1 `, n8 \document.write('</td></table>')" h1 n7 d$ i  |7 [3 L
}0 W& X) ~* V  W: ^& i1 P) o
}
& b* ?* o/ Q# C. n" t2 J& v, R</script>

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