返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 a4 G5 C3 G1 ?3 G  _; G
var marqueewidth=300
3 w; P8 D2 l' M, i$ [0 t//高度
0 ]! ]( a+ z8 s  N7 O4 F+ H2 vvar marqueeheight=255 a. x6 o8 L. N  R! P6 m/ N
//速度(1-10)( D; f1 p( N% c- a7 a' W( ]
var marqueespeed=3
7 e9 \2 l  @3 s5 s' V  v//背景颜色
6 {4 D* }8 i' g8 wvar marqueebgcolor="#FFFFFF"5 H( D: a8 s$ G5 K: g
//是否能暂停 (0=no. 1=yes)?+ B4 @+ O5 K& s- O
var pauseit=1
% [# m) X0 |. H% T
6 U6 ?( H8 V8 T) ^/ B//修改显示内容
5 v8 E' ]2 w6 @- {- \4 H2 A' yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. h, j  |' z4 g$ N: u  C6 }: n5 Z/ P4 ~- c2 N/ z: z

* N2 [3 w$ T% g, c  q////下面不需改变////////////, E% n8 u1 T( e, p  a
# {4 Q1 c' J' @$ }
var copyspeed=marqueespeed0 I: p! B+ y$ K3 \0 P7 h
var pausespeed=(pauseit==0)? copyspeed: 0
# u: ?5 w( o# f2 k* }  R( z3 bvar iedom=document.all||document.getElementById
; E% X4 j/ v$ J) J- f7 r/ Lif (iedom)( ]0 l+ X# N! V% P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 L* v/ S) Y2 E. E
var actualwidth=''& L+ f( w6 @  \5 F6 S! U$ V3 r
var cross_marquee, ns_marquee
6 w: m" L2 s5 j4 i8 X5 J& p0 E  b9 h3 L- Q3 ^6 p
function populate(){$ [) H2 _' p: Y0 R5 f
if (iedom){) f0 A0 H& A2 T+ V' [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ?9 h* @( x: t/ z. h# ?# ~
cross_marquee.style.left=marqueewidth+8  }+ V3 X5 A; _# S: R
cross_marquee.innerHTML=marqueecontent4 K7 m, t  n$ \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- v8 B# ?  [0 n  b% K}* O  t" w: l5 P. Z& |
else if (document.layers){, D: k: i, W& V9 l4 Q9 X
ns_marquee=document.ns_marquee.document.ns_marquee2- B) c/ W8 j/ w  y% O; m3 i
ns_marquee.left=marqueewidth+8
' t. M& x* U2 L: Zns_marquee.document.write(marqueecontent)2 K3 a1 h0 {3 ^  p# g! d* W8 v
ns_marquee.document.close()1 \' _( p9 S3 ?" o* q7 k, F* P4 D
actualwidth=ns_marquee.document.width
+ S0 T' f& ~5 ?* I1 n}7 T* x, y2 S9 K+ ]/ u: {
lefttime=setInterval("scrollmarquee()",20)! F7 E' a! D. x: U9 Q: O% J5 y
}
6 V2 J. b7 r5 P! }" z: H* jwindow.onload=populate
/ ~6 H! J% B) V8 I* B
) R9 D$ n0 e7 v5 h% vfunction scrollmarquee(){
! U0 I2 }- D% gif (iedom){/ v" }  u" n# I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), z' x: r6 b! g: R2 o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' |) J% T1 E: i( telse2 n  R. F/ r: o. z3 j, b" W2 n
cross_marquee.style.left=marqueewidth+8$ w" w0 J! }; z. p

/ `4 e' Z; |3 z, @5 X}" J* w6 n  G$ d5 j' H! ]4 V
else if (document.layers){
) f# v4 _8 V/ aif (ns_marquee.left>(actualwidth*(-1)+8))
/ A" P5 a4 i. X! H6 {ns_marquee.left-=copyspeed( W* M. b0 C8 o0 r5 B$ S
else7 t# {& p7 d7 B$ \( ~- Z
ns_marquee.left=marqueewidth+8
3 X$ A& F1 v0 W. |# `/ x6 m; F}. J  b' }. x. j* ^+ ^% }2 g
}
9 V; I) |! `" L6 ^
- Z$ N2 @1 f) x3 i" L; F$ N4 X% U# ?* Bif (iedom||document.layers){
5 p0 r. b: R7 b6 s; W$ q5 `6 U; hwith (document){
$ ]4 n* r9 p" s* Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 L. G, s+ ~! @: C/ M6 @
if (iedom){! j3 E- i" f+ \1 P4 Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 w0 t8 q# e: O5 `% |# J) Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. X* @9 |4 E( Q2 o) u+ U5 V7 }. W+ |: Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 b" ?8 w) J8 \" v  y1 k
write('</div>')9 ^# ^; d6 ~4 K2 ]- y1 {
}) R, Z7 e8 [2 _8 m: H
else if (document.layers){
' M5 Y% R& G) Y! @( ]9 mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( Z3 S( P; S  ?! ]+ U2 Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ `1 k; U: j( Q1 D/ Y- {. n( Hwrite('</ilayer>')
. z) E! w# P7 [- T}; i/ H. @4 l# B5 K! C: |; _
document.write('</td></table>'); f* Q7 ]2 K1 o: ~
}
7 v8 Y$ {. h+ `6 n$ A}
7 ~, K* a/ y. i# M9 z5 Y9 Z. Y</script>

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