返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: z9 C; s1 r* xvar marqueewidth=300  u3 q) l$ {- |* J7 {% m
//高度1 R' R  m  Z) R: F7 X" I
var marqueeheight=25
! `2 T8 [6 s7 L1 r, G" V9 }' F//速度(1-10)
, _- y# I- l4 l: \+ Jvar marqueespeed=3
: x6 }5 h8 ]; H* Y4 u: f+ `) K//背景颜色
! S( {) V8 N4 Ivar marqueebgcolor="#FFFFFF"7 z7 a' K0 {/ J- z2 J5 `
//是否能暂停 (0=no. 1=yes)?
/ X( }/ \, R1 Z9 M0 Evar pauseit=1
8 w* l) X) J7 @8 I) O" _" A- h5 v" _) H) P# Q. s
//修改显示内容7 [( j6 M& c: Q- Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 `7 y* }% {, X/ ?8 L: E$ D; u

- q0 `0 N1 i6 n4 }; B2 l0 r; [$ i+ f# C# x+ b
////下面不需改变////////////8 z/ ?8 D: |, G; w

" ]$ y# l5 W) C9 Tvar copyspeed=marqueespeed
& U$ F+ X2 X0 }- q+ wvar pausespeed=(pauseit==0)? copyspeed: 0* W0 F- c8 V" o
var iedom=document.all||document.getElementById
5 w, w6 U; j3 x% B! R/ i) Bif (iedom)( F3 T5 s0 C2 g  g$ u4 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 ?' O, Z8 e7 C. e0 yvar actualwidth=''8 C$ Z3 b9 `. {! f
var cross_marquee, ns_marquee
/ P0 U6 q& B* O- Z
: a. f( c& C, [& ]+ m* }function populate(){
# {0 B+ Q5 Z' |, Jif (iedom){# @/ ^4 O' N$ X9 T* _1 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ O7 J3 A6 B0 T& p" r
cross_marquee.style.left=marqueewidth+83 |' d: K- O5 G8 u
cross_marquee.innerHTML=marqueecontent# q% `  z" u; q* L) b. G  P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. |, m9 C  D' Y8 O# N
}6 g* O  I6 m5 L. h. N- e8 E6 e
else if (document.layers){6 d% T; Z1 {& i, S
ns_marquee=document.ns_marquee.document.ns_marquee2
1 R5 x( L; D+ \- w& V/ ^1 a/ @7 mns_marquee.left=marqueewidth+8+ n7 c0 f3 t' e4 r4 p4 B. B
ns_marquee.document.write(marqueecontent)
( e2 j" S+ R( [7 C; qns_marquee.document.close()& b  V" H& U* e& ~+ g
actualwidth=ns_marquee.document.width# {7 s1 }, O' F! E$ p8 O" R
}
, }) u, `5 O9 Y( M) j/ ?* Y/ {lefttime=setInterval("scrollmarquee()",20)5 L+ b2 b1 f  h) A+ p4 X* @) M/ ]
}
, a4 g- }. O: |& Ewindow.onload=populate# p4 N4 L3 p0 d1 s1 z! ?

" P0 K0 |, C8 D3 D3 gfunction scrollmarquee(){
; a+ @8 Q4 {7 j# q1 U& b5 t! Qif (iedom){8 z, B' u6 i; M& [+ e8 S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 S) G0 v4 T* Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' k+ C: E, `4 j4 \7 y7 d
else- G  f4 S! Y! J2 ^
cross_marquee.style.left=marqueewidth+8( p" T3 v. a0 o% A; T
# `5 `& l: `$ ~# r# O& D
}
5 |" S/ W5 d) p/ _, n: i# @' velse if (document.layers){
1 t. u# b8 L( a: nif (ns_marquee.left>(actualwidth*(-1)+8))" Z% k1 s( G4 o# N) P4 L5 r: M1 v
ns_marquee.left-=copyspeed: x: j, n- g' ~/ V+ {/ P7 n& V" z  ~
else. F; @6 y3 X- s9 o8 u
ns_marquee.left=marqueewidth+8
9 u+ C! N7 J: Z/ y8 l$ M) E}4 y9 w) p4 D  o$ r
}
' F  [0 Z; b  \! {+ g5 X6 ^! I
$ w$ k( B7 O0 O( S7 mif (iedom||document.layers){! I% l# l3 z8 ^1 M( j0 Z
with (document){: M  Z  G3 k- F! \/ Q# Q* B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 C8 X' k7 E; y9 l
if (iedom){
/ M5 [+ ?% G" D. ?9 H3 @2 c" d5 dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* ]+ c6 b- z$ O* Z; gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( d! w) C+ |) m, ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 J( _' M) |: S/ X& O8 I
write('</div>')' o" ~: M) J$ ]% H3 M% X3 [. _( W
}
  `( x+ z) F9 X7 [4 Oelse if (document.layers){
& [% ~7 |( X! y4 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 p* I. C! c# V, x0 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ W4 @- q' U" W  h" @6 B0 [& r
write('</ilayer>')
. q5 Q! t( U, [9 S  @4 v}$ E; o8 r0 D* v0 Z- {+ Y
document.write('</td></table>')
- N- }+ ?+ c) U9 J}: J& ^) O3 e6 Z/ F* R
}( `  `5 e6 K# H! @8 U, h# O
</script>

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