返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 R7 u2 L3 P# T/ m
var marqueewidth=300$ b/ h' }: G- O
//高度
8 y9 P+ R, J/ B3 hvar marqueeheight=25
5 r, D% g* N+ n' a! |9 K  o) U//速度(1-10)1 m% L( \* t7 U. L8 a2 A
var marqueespeed=3
5 x( c' l# N6 X, [$ e6 h//背景颜色! y  j, Y8 L; |5 V' S' z
var marqueebgcolor="#FFFFFF"
7 f) \6 g( O* |; v4 b7 \! k4 W' N- O//是否能暂停 (0=no. 1=yes)?
6 N. ^- l. b5 W9 c% O- x- vvar pauseit=1
/ h! r7 O8 k% ]: Z% T" k' m2 |; V" z9 ]
//修改显示内容9 X$ G% Y, R# h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 r0 d: {* o. L0 L- q# i4 T- F& l1 M8 v. {+ w' T, H
' ^, t4 Z/ B' K
////下面不需改变////////////
- r3 @  P+ J7 J9 U$ r) A% C9 A7 i: T0 [5 h
var copyspeed=marqueespeed; h, M( w4 Y/ y# r; p5 ^
var pausespeed=(pauseit==0)? copyspeed: 0
1 R) k: Z9 Q2 Jvar iedom=document.all||document.getElementById$ |1 G7 q2 a% x5 K0 c. n  A2 G6 ?0 |
if (iedom)& E" ]: E' ]' q+ y) Y8 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 q+ w3 W" n! I% s* N: |- J
var actualwidth=''
  a$ J  i/ p  y: v0 Gvar cross_marquee, ns_marquee
8 w/ B( {/ Y$ [/ s' D4 a; N( e. P9 j4 q  Y
function populate(){5 r: ^) L4 H9 E, k2 s! D
if (iedom){
. D1 I, J9 f0 h1 Q+ S8 d- wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ K6 @7 g1 O9 D, v( @
cross_marquee.style.left=marqueewidth+8
# v! K3 V$ a! |1 x8 Mcross_marquee.innerHTML=marqueecontent* S# F! E& G- T* H% j4 Y" S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" k$ J5 P  x) A}
- j9 [; m9 x- D: a: f5 x8 lelse if (document.layers){
0 P4 K/ L) Y2 L7 H5 M. ], s0 p% Qns_marquee=document.ns_marquee.document.ns_marquee2
7 |0 Q) n3 ]. R. j9 i3 nns_marquee.left=marqueewidth+8
# j8 [4 `: e& z' B! Rns_marquee.document.write(marqueecontent)
1 ?- z3 r7 }- {/ zns_marquee.document.close()
4 d6 _7 b+ G- d/ S6 d# n$ c7 \  m8 Wactualwidth=ns_marquee.document.width
3 \. r& L# H6 u8 @0 a0 @}
  }) v- F* _3 u" @8 {' K6 blefttime=setInterval("scrollmarquee()",20)4 f" J8 ]8 x4 y8 q6 T0 H% b
}
0 R7 L' P" l! `6 ]! _% P# s; J" V6 Iwindow.onload=populate
" I# c/ U0 q2 |2 g2 l2 E; G9 z/ E
5 P( M: n8 \7 P6 o7 S8 \8 Xfunction scrollmarquee(){0 X0 Y( \: ]3 T# ~, W) ~# D
if (iedom){
- f0 J& z9 W2 ]" s! J6 Y% eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ ]) e% |3 k! }$ R' W& I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ n* P" r' G% O2 z5 t3 Z/ }1 _8 ^! Uelse- m* ]( j1 S" S* J% y2 s6 E/ |0 @5 w
cross_marquee.style.left=marqueewidth+8/ `+ S! ~; Q; m" ]/ W

4 v1 b3 T# D; ^6 a; V' Y}6 K1 N! l5 {+ S, u. d2 c
else if (document.layers){0 Q; K+ K( Q- Q3 x& Q+ z0 O( H
if (ns_marquee.left>(actualwidth*(-1)+8))! F; m$ U* P% A' y
ns_marquee.left-=copyspeed
" K' o1 ]+ B: Z. }# f- r9 a5 A; welse
& `" S3 q& w$ b# q7 ons_marquee.left=marqueewidth+8
) ?+ \+ g9 N* i' h3 ?}! g) _& L4 E' H  S" _( b
}
4 o) i5 ?+ x% @2 l8 p$ ?0 C) D4 g# d* u# B) a7 J. V1 I7 F1 h) [
if (iedom||document.layers){7 g" [) Z6 g* v
with (document){% S; v3 E/ ^3 \' d- [8 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 P1 f; ^3 M* t5 `* Cif (iedom){
# z7 ?) L% ^, B" s' P5 i2 Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 |. W( C/ b9 X$ f/ @+ hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& A- ?! N' p4 e7 |7 F. j2 Y' K& Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). N3 g  Z+ C0 ]$ S  j( X3 T$ u
write('</div>')" V3 G& E: l. X, o' B
}* m) F1 |. U/ l0 _4 y, C
else if (document.layers){
( ^  u( o% W9 o; p$ M7 _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); l% E: r4 ~! E# A1 n* z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* L( y& e8 Z( x4 x5 |, i* Bwrite('</ilayer>'): Q  `# D7 i' O; b9 [6 n. a/ r; R
}
$ F: ^' R: k' }8 N( N* udocument.write('</td></table>')/ W5 H, S, ]! h/ A7 P
}, Z7 e( B3 H2 e3 {/ X: H# P2 U$ U
}! M/ F  `. O: B9 [5 M1 Q
</script>

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