返回列表 发帖

网页之跑马灯文字特效

//修改宽度, B- T4 K6 Z- ~/ k" B9 U3 h) t* u
var marqueewidth=300
0 k  A1 I( u" p+ o, r/ f# h$ f) e! c//高度6 V* J9 ~6 k) }9 `. p
var marqueeheight=253 Z) T2 e3 U; f9 a# C
//速度(1-10)
8 }0 Z0 k3 T- }# S% e% Cvar marqueespeed=3
% J( c2 o4 i, g, v* K2 s//背景颜色
6 I3 {& z( n1 m& W; v6 Vvar marqueebgcolor="#FFFFFF"% i' h3 B9 ~0 ]9 Y# Y
//是否能暂停 (0=no. 1=yes)?
3 T" @. d& V7 P- zvar pauseit=1
0 B+ A' J3 ^. Q) @9 z* P3 R! W  d  k1 }0 Z( B7 U
//修改显示内容6 j- ?4 d  [! O: `4 J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 D5 J8 u3 k& g+ j* n9 H( q
* Q& x) t/ K4 i/ }  t, \
( ~& V) U& l, r- d! |- A////下面不需改变////////////- x  G: F' p  ?8 Q
) J. E3 |+ _0 I
var copyspeed=marqueespeed
! G) r5 P, e8 P4 X! L0 u% Lvar pausespeed=(pauseit==0)? copyspeed: 0
: F3 U1 }& F/ R1 J9 [var iedom=document.all||document.getElementById; H$ r: S& I2 A0 N3 u0 D
if (iedom)9 I$ i' B0 O' `6 ?' D% s6 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* n  N' O3 d$ G, x2 S$ C1 j
var actualwidth=''; i# Y9 M2 z) u) |! L7 M5 Q9 q
var cross_marquee, ns_marquee
$ m+ d9 n: M7 J' T7 k9 q# d8 w: X6 J
function populate(){2 K+ I* X0 |$ d; s/ A$ k
if (iedom){+ @" W! ]% n) T! m+ x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 I+ [; }9 b7 n( l
cross_marquee.style.left=marqueewidth+85 }3 C  \  F" b. v$ A6 F
cross_marquee.innerHTML=marqueecontent; t: j. n6 S* K" A' r7 O  g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 D* \* f* o& D/ ^* M5 ]
}
; P/ H$ Q( W. Z+ @6 felse if (document.layers){
; f& O# P4 l( x9 e* g$ hns_marquee=document.ns_marquee.document.ns_marquee2
6 W: w( T- x( B  w! g1 b, \ns_marquee.left=marqueewidth+8
4 k# n9 o; v" H" f  L6 Fns_marquee.document.write(marqueecontent)
; g9 u( I) G3 Y, Gns_marquee.document.close()
( m6 i" M. K$ ?$ d4 Q6 O3 eactualwidth=ns_marquee.document.width& B& B. D  N* k
}
$ \4 u! k) l# ]% Q9 j7 _; j* g% ^2 Olefttime=setInterval("scrollmarquee()",20)
9 d5 X+ E5 U$ D; G1 c7 Z' t( v}$ o$ o, C, f( g) v& ~; S5 B/ g
window.onload=populate
& H/ [7 K! w8 I& O, T# w& q
: P7 v4 s" k- Zfunction scrollmarquee(){
2 m0 {0 j2 T! W' I, fif (iedom){; E# x) J5 ~& \% r* z* R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- @, Y8 e$ ]; U% O! qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! ]8 N1 Y' h' Z3 q) N4 @8 Gelse
9 Q1 M( g# M8 j! ]5 Fcross_marquee.style.left=marqueewidth+8
0 _) z5 \: R  p, c! b/ i4 V
; O: C$ K9 M8 H, A/ `% I}2 k2 ]" y% m8 m
else if (document.layers){
- o' G6 P. T5 p& Lif (ns_marquee.left>(actualwidth*(-1)+8))" U: _) M0 d; g$ D
ns_marquee.left-=copyspeed
  K) X4 o0 h3 z( T1 k% velse
8 {0 x8 p& l' ?$ d4 n  I8 `( v) f3 ans_marquee.left=marqueewidth+8
: A4 G& |2 O8 c9 N% l}+ w$ c9 P+ `6 b$ h" u; g
}
3 z8 Z1 Y. t1 M% a% J3 d6 L- o  }; A* ^) N+ S, c
if (iedom||document.layers){2 Z0 j& k3 {# W- O
with (document){
( T( R% E7 [0 R9 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" s& x7 h) }% V5 l: O0 t: d$ L
if (iedom){8 Y( ]( T! }) O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! b# }5 m" a" s, U2 w; z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' w0 r: {( l# v% q4 i9 ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" s+ X& O6 C$ E" u+ w/ f
write('</div>')# n3 v+ U5 z1 T  f
}
7 Y' z1 H5 V! c! X8 O' Celse if (document.layers){
. I& J, K# y# ]: z9 G" kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 n, w  e  N' r1 F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, C- y4 z7 a8 A! c7 ^write('</ilayer>')
0 A  @! P1 L4 `& \0 Q}
5 Y( f, `' b5 j5 j$ q4 ^document.write('</td></table>')6 P- n7 `$ {1 ]
}
: N( D* J, {, P! I; z+ S% o}' \3 Q8 W/ [# y# o& F! c8 S
</script>

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