返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ D2 U0 l4 M4 }7 h8 vvar marqueewidth=300
) U2 M0 \4 A% @( `: _& _3 H0 m: \//高度' g" J2 y. a$ h# `
var marqueeheight=25
0 I2 e6 F3 v7 l5 H6 \& u1 p- O( a//速度(1-10)
2 ~( O% O# B, g/ q, D' Qvar marqueespeed=3/ S6 m( ?# ~" _4 @8 z( P
//背景颜色
8 {+ d7 `3 [' ?. Dvar marqueebgcolor="#FFFFFF"
* l) I) Q  G% `3 w7 w//是否能暂停 (0=no. 1=yes)?
" |6 J1 }, R: B  p7 vvar pauseit=1$ j" s4 G0 Z& f
3 x0 }' ^$ Z$ ^, C7 r) h  g
//修改显示内容) s  ~5 r  y8 t' r4 F% p! p, I8 m) u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( i9 @; T8 H9 {/ e; e8 N

/ r0 v, P% z1 V; N2 _" r
$ j  g  ]8 k7 h$ W////下面不需改变////////////* ]& U6 c9 p+ L0 i' W, n

6 E3 m8 Q2 d' ovar copyspeed=marqueespeed* F" c/ j. b' S2 _
var pausespeed=(pauseit==0)? copyspeed: 0
0 e2 n. Z/ F5 G6 @var iedom=document.all||document.getElementById. ~  \1 `9 f9 u+ B9 X
if (iedom)/ x- N( Y; `5 x, ~# t; F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 h* q. N. I% E
var actualwidth=''
! t. b2 H. m$ f, p0 K% n# P. d8 E9 zvar cross_marquee, ns_marquee0 I; M. Y8 i6 }& K' j: d0 f

  \* s1 m& h; S( Mfunction populate(){
6 m& o4 j! n" G. V- Hif (iedom){
/ s' ]1 [" S7 n7 Q# o2 }, q1 Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. A6 F- r' D% l/ w* @9 ccross_marquee.style.left=marqueewidth+8
+ x% a  d9 j: d: w' Ncross_marquee.innerHTML=marqueecontent
! L2 }/ |5 G, i1 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ ?) }! ^: m% V  `$ y1 v
}
/ K/ q" n; [* x3 \2 Eelse if (document.layers){& E/ C0 q1 I( O  K0 s) i
ns_marquee=document.ns_marquee.document.ns_marquee2  D  q6 ~9 c2 i( G
ns_marquee.left=marqueewidth+8' z$ U3 D" H: S5 Z- K( n# r+ ~
ns_marquee.document.write(marqueecontent)+ b) H5 c2 y3 v
ns_marquee.document.close(), c' V% b0 E. X$ c, x- \" C
actualwidth=ns_marquee.document.width
4 _, I; m3 `* L! |. A}5 E+ t# P: B3 E
lefttime=setInterval("scrollmarquee()",20)
9 @8 L4 E3 m7 F% }}
! E& ~" _& G) k( a) [" bwindow.onload=populate4 W0 k! B$ s/ Q
3 b3 q4 h% R3 y9 H0 G1 n0 Q* f  d/ q
function scrollmarquee(){7 R. Y; N6 M1 w. f$ j
if (iedom){
+ \+ t+ T9 j8 u: ]# Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( j( p0 h, f8 u$ P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ x1 W- {4 H8 q
else1 _: x8 U4 z' X
cross_marquee.style.left=marqueewidth+8' N- k4 \& @' H% M4 n+ w' f2 m
) y% o% t: K, m0 u1 P$ N+ K5 P
}
9 F! ]4 o# p+ ]% v8 i3 Nelse if (document.layers){
5 I0 p! g# O# q1 a, I7 fif (ns_marquee.left>(actualwidth*(-1)+8))0 b. l6 Z3 X  g, Y
ns_marquee.left-=copyspeed. B- f' o" M+ {) C% @
else7 D2 P0 Q5 X# d- P5 N6 A8 Z
ns_marquee.left=marqueewidth+8
7 v+ i0 V" l7 v$ C5 G; V. V}# z) t" H6 U5 F
}
! G( T3 A  T# K; h3 _. v+ m0 `( ^% _0 t$ h
if (iedom||document.layers){
; s, A' ^! C+ h' b$ l1 f& b1 t9 Awith (document){* }7 _% k& L. [$ v& ^/ k/ `; T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 N# B" v4 m# j  `- B, `7 A: ~- K
if (iedom){
; t) H* v$ B" Z$ P; @: wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 G; m: g/ N6 E" i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' v4 s; ^, _  Z& p3 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" q3 m( D) g' O7 t! a' q$ C4 B
write('</div>')3 k" K4 @  d1 y0 u2 S; R
}
5 P2 ]. N- p8 Z5 h1 xelse if (document.layers){" Z9 g, _& t& j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 z2 b4 I2 k* G/ l) t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); M1 T& l/ v$ g) l% r9 N; M7 M
write('</ilayer>')
9 t* M8 ?# r0 D& ~}2 e# n" ]2 n& d6 t0 A
document.write('</td></table>')4 [) k6 J  V4 a9 |
}% D  z- y. k( o# X
}6 l1 z) |, ^2 C; U6 w* Z3 X6 T: l! c
</script>

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