返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 i% s/ z7 G/ ]3 n- j( Z  g9 _var marqueewidth=3008 X: |% ?" p3 H; u( ~, P8 F" \
//高度5 V# N/ i0 i& z
var marqueeheight=251 C, D, l' z0 f% E7 `! D5 C
//速度(1-10)
/ t" n" F, i  ^: @var marqueespeed=3
  F) Y9 M; w: o' v. T9 i+ g//背景颜色* L( k' n+ A/ E0 N
var marqueebgcolor="#FFFFFF"' y8 V7 ?5 k0 F* P0 ^6 n3 U7 P: m
//是否能暂停 (0=no. 1=yes)?0 }& W+ x; U5 s4 G3 L* _) P
var pauseit=1
  b4 O( ]/ d/ \1 V1 S
* v6 `  M* P/ l4 C; n//修改显示内容
4 x: c) S% r. m" y6 Y) k) E9 Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ P5 F+ H9 u' ^6 Q7 d  F# Y% D
2 K/ u* t+ T  m- |/ V# j9 d0 p- A* h. k. D
////下面不需改变////////////
1 c  u3 S( p9 n$ B  f
. M4 E2 l& ?9 j: A  v6 yvar copyspeed=marqueespeed
% S2 z2 y, X* d( C9 N: R* {: Fvar pausespeed=(pauseit==0)? copyspeed: 03 i/ O, Z& c0 V
var iedom=document.all||document.getElementById
/ T3 c1 l1 J% ]7 \if (iedom); Y1 g% [  }+ R1 t% O/ t; f9 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 ?: r3 |0 g$ ^( o3 z5 V; vvar actualwidth=''' \9 `# d: F( J  I7 Z
var cross_marquee, ns_marquee4 |) e/ u+ n1 z; _/ H% Q
: ]) e0 K" |' f# q  H& Q4 t
function populate(){* r9 |1 K0 q. T) I  S# _5 j
if (iedom){2 J2 f5 L, [/ K3 H1 r; z, y2 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( {4 r/ ^4 F" ]
cross_marquee.style.left=marqueewidth+8( X% O4 Y9 P$ i
cross_marquee.innerHTML=marqueecontent3 F, G, ~9 q9 D6 k( E3 b- `% Z7 ?( {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, L5 B; ?# R$ e7 Q
}& v( d) c1 G2 |" g# K* P3 S
else if (document.layers){
% L; \! v, X) l& lns_marquee=document.ns_marquee.document.ns_marquee2
' [# o6 _8 L" c) l$ zns_marquee.left=marqueewidth+8, l. N: `7 j( E7 ^/ s
ns_marquee.document.write(marqueecontent)/ Q4 @6 q) r' h* P/ f" l2 q  V
ns_marquee.document.close()
8 N- B9 \( H; C6 m5 eactualwidth=ns_marquee.document.width: U/ W( p, s7 `  |
}
' u$ d( C* r( q6 i$ Blefttime=setInterval("scrollmarquee()",20)9 O1 x% U: p' A# q- ^
}
2 r/ D6 u2 z9 Z0 D/ f+ ^window.onload=populate
; P  m  L8 R  Z7 ^% ~9 F5 d0 ?: }" A! S1 W
function scrollmarquee(){, j7 g3 G. @$ X$ ~! ]3 ?
if (iedom){
4 ]( Z, |( j+ [6 L2 J( [8 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( p8 K' p+ P' R- m" X+ [% i3 Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: m% J. V0 B; ^* {$ P* ~else
. B7 M+ c8 [$ N0 h' Bcross_marquee.style.left=marqueewidth+8
  ?* l; L1 x% ~/ L& X  a8 G
$ J* D+ \; o: R  I' D! H}) L) b+ z! {8 ]$ o- U$ f! `5 E. h+ d
else if (document.layers){
) u: j! m5 R" ^if (ns_marquee.left>(actualwidth*(-1)+8))
5 E# X$ Q% O7 vns_marquee.left-=copyspeed
- q- s) ~" c) ^3 _& d9 telse
$ S3 U1 v/ s; ^& K+ E1 \2 i$ Wns_marquee.left=marqueewidth+8
5 g. c" o) W9 z: L5 m$ @0 Q}0 _$ F! c* }0 q- e0 u
}
0 i1 H0 _2 Q- v6 ~% K6 Z/ h# r6 A% [3 C! x" q1 X
if (iedom||document.layers){4 M$ k- z8 t2 n/ ]
with (document){3 X* h3 n' f4 W6 W6 p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* U  J8 {* g0 s- c' j# K- L2 vif (iedom){
7 h& g" i8 ?* H0 i/ H$ q  zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 P1 E. c. o" {, }: E8 ?7 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 A1 ^9 D  \  Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# O! w2 t8 Y4 c, B$ ]6 Jwrite('</div>')
# ~# x1 M1 ~) H" m# Q}% i0 j# R" x; c  O& q+ U  F
else if (document.layers){3 Z: I  t$ U+ G9 g) z2 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" E/ G( J6 ~/ f( n$ s' n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 [% {3 r8 A8 ?- g- |& Zwrite('</ilayer>')
" ^: p! L3 u! l, x) [* d/ x2 h' q}) _% R/ H# Y) l7 n
document.write('</td></table>')
/ _7 [! A( T- g}1 \) O  G7 A/ H" J: u
}
/ d# I! h: Y- Q# `# I6 [" s</script>

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