返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 U2 F2 r0 z" l+ D% \8 h/ dvar marqueewidth=300
' f7 X) z' y0 \! W: j0 U//高度7 C$ I& _' y- [4 S6 R8 N
var marqueeheight=25" K( N4 @& |6 a% q
//速度(1-10)
1 K! H! {8 k! w! G* M0 ?( j% b" vvar marqueespeed=38 i$ x, Y& f. b" R% v( R' N
//背景颜色8 \( f2 C3 n" B5 ~7 J/ {5 f
var marqueebgcolor="#FFFFFF"" ?! U& L, N5 Y3 f) h' _
//是否能暂停 (0=no. 1=yes)?
3 {7 u" C$ A) |/ t" e# Cvar pauseit=1
3 Z% @& t4 O/ F4 ^% u& V3 h7 z. ?5 }: X0 u2 c7 q# d
//修改显示内容
/ O3 F9 r/ j4 I" l- _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! Z* l6 e! G4 ]0 u
/ H% c& G1 x4 R4 I- C% J# |1 r
- G- D( B- Z3 L7 F////下面不需改变////////////# g1 t" y# ^" `

) e# h8 f: s9 P% D' _0 s% nvar copyspeed=marqueespeed4 E/ ~5 t& P' T# o+ e0 P2 W! Y
var pausespeed=(pauseit==0)? copyspeed: 0
+ |4 Y: d5 U9 e8 B( evar iedom=document.all||document.getElementById
% x7 ~# P4 w+ G& ?- c& ~/ iif (iedom)+ K5 @$ Z* D' N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. r6 n# d: U3 U+ v( Y8 c9 d" Qvar actualwidth=''5 p6 W" f* k4 r1 m
var cross_marquee, ns_marquee3 @; h- M- [, R0 ~6 k* W

* Q& w6 i* Y0 C) G5 O0 j7 Efunction populate(){; k* D8 p9 Z7 p4 k+ {3 v  h4 D
if (iedom){) P1 F( t4 X" e- a' @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 q. O% F+ n9 I& _! d( k0 C" \- {cross_marquee.style.left=marqueewidth+8* i; Q5 d5 x5 M  G
cross_marquee.innerHTML=marqueecontent! T* j6 F) ~; A! D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 j" `2 R% v4 S, f' ~3 S0 p}/ _" A. g5 m2 o% Y
else if (document.layers){
- c9 _4 i$ h9 }6 S! F' }ns_marquee=document.ns_marquee.document.ns_marquee23 _1 O9 G" P& i$ X* ~3 ?' G5 F2 h, Y
ns_marquee.left=marqueewidth+8
7 Z  {6 p) [0 _1 n* F; {  Y& rns_marquee.document.write(marqueecontent)2 j4 X; _/ }  w0 C8 c5 U7 I$ |
ns_marquee.document.close()6 ~7 ~8 q$ @% j. W9 [. G% _
actualwidth=ns_marquee.document.width
+ B# N6 M. z9 y}3 B3 v) e  t% ~0 Y  K2 m0 [% V8 Q2 w7 ^. m
lefttime=setInterval("scrollmarquee()",20)
3 J; c/ P+ Y' r3 \- I7 |$ t}! z2 L* d! S' \$ W$ U
window.onload=populate  R7 u+ f1 _: P$ r
) w( t% V% _8 _+ p' r
function scrollmarquee(){
9 s0 h6 V4 I7 F& \" ?6 b% K9 Pif (iedom){
& |# y  f2 \9 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 F2 C. r9 a2 k- U; l, _7 |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 Y5 o# T. X. S: b' P" G; S6 pelse
9 m8 D# u/ L4 ?6 L2 B+ u0 Ucross_marquee.style.left=marqueewidth+8
8 _. F5 S, R6 u- o% _9 J
# q/ B" P+ B+ H3 u( n0 Z9 R}
* {1 F* y+ y0 u! c' P9 melse if (document.layers){: k+ m5 x8 u) n2 w
if (ns_marquee.left>(actualwidth*(-1)+8))
9 F0 U' v& Q# t5 j$ \  Ins_marquee.left-=copyspeed: w9 N% Z1 V! [" |+ H
else
- s2 W% `' p5 R/ a, I' Kns_marquee.left=marqueewidth+8
' G! d5 d7 `% A; K9 `- \}9 R! y& j/ J# X# I( k
}% S3 u/ [4 P& \, r. P% P1 W

& E. H" l0 ?& n9 Y7 Kif (iedom||document.layers){# T  x, p! b$ q; }
with (document){& M$ p  V( [3 B; \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( q9 ^- @4 v1 A3 N( \
if (iedom){$ }  Y' I7 v& N2 k. b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 K) T6 H  B# O% C# t9 H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  J0 [0 X- Z* C3 a  _/ @) f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" f% l, Q" |; \3 c# z1 Mwrite('</div>')
" D, _, x1 t: G% [/ h/ H+ f}' {$ u) L# r) l; m1 E; n# N4 e" K
else if (document.layers){/ a! p. E# H- |9 J; M  q  I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. k& X: P% ]) U) `1 g0 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 |4 h  F% ?2 twrite('</ilayer>')
9 I8 o. v$ m7 ?2 h3 a}
5 _5 G8 F2 `* \1 m) [document.write('</td></table>')* Z3 V8 b8 m. R$ S" n6 q  k( \- Y
}
  E3 `3 g. e) \1 c. @- [}
( J7 }+ n, U* N! {3 y1 u7 Q* h: n</script>

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