返回列表 发帖

网页之跑马灯文字特效

//修改宽度) i" U" F5 g: x% u% {; Y- x
var marqueewidth=300
5 X  c9 Z/ e, ^" P: f//高度
1 `5 B8 S) ]; Wvar marqueeheight=25/ }8 V, g7 j1 {
//速度(1-10)# i$ z# Y. X* z  r
var marqueespeed=32 ?+ y; U' o+ Z. Y! ?
//背景颜色' I8 w' }: K( l9 e" u
var marqueebgcolor="#FFFFFF"1 G- ]. j3 b) s" O7 v
//是否能暂停 (0=no. 1=yes)?) H5 ^$ T+ S0 k) }% g
var pauseit=14 b3 @+ t" e" ^1 a
1 ^8 y. }7 M- b# U( q9 e% J: Y. v
//修改显示内容' a# D, Z; Q: T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 y4 d: v$ x# J2 u7 w% C5 l
1 d! D& @9 o& D- t
7 @! P4 I% x: k( \9 J. z3 V- H////下面不需改变////////////: A$ d% I6 z3 a4 V/ S
  a6 u* t; E3 E& @8 s" N
var copyspeed=marqueespeed9 U8 C) Z$ Z0 _1 [
var pausespeed=(pauseit==0)? copyspeed: 04 P% i$ S& x; G7 F4 g9 L
var iedom=document.all||document.getElementById
! r2 ?1 \2 x7 R' h$ {if (iedom)" u  n/ I4 D4 j* H& e% u( O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 M7 z; }! m& @
var actualwidth='', ?  o9 c) v+ \  }+ |
var cross_marquee, ns_marquee' G, O1 ?$ E# Y0 {  r
7 X/ P6 [: W: \% O6 a5 _' T
function populate(){, y1 K6 K+ I( }- F
if (iedom){: y' i$ ^5 X7 ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& E: e5 H5 a- q4 ]( o, D8 w/ [. d! H
cross_marquee.style.left=marqueewidth+8: p# {* U$ w) J8 A
cross_marquee.innerHTML=marqueecontent
# j6 Z# {3 d0 w. S; Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' g' p' h- {: x/ j}
- R* I: P# J' v* N; o" l! f# zelse if (document.layers){" E. z) P- r' h1 k# r
ns_marquee=document.ns_marquee.document.ns_marquee2$ v1 X! K8 P/ H8 l4 E+ P3 Y0 ~
ns_marquee.left=marqueewidth+8
7 e5 C" G) X& @) a9 T/ x. Rns_marquee.document.write(marqueecontent)
1 w) G) p/ m3 Wns_marquee.document.close()* |0 ~6 v9 ~! h4 ~' g2 j4 G- W
actualwidth=ns_marquee.document.width/ l) E0 ^0 y5 I7 ^- c1 w4 ]1 w- u
}9 H+ Q1 c" O7 e+ ^; y+ s
lefttime=setInterval("scrollmarquee()",20)
/ `# \4 \. M/ D}3 l7 D' O2 Y: f5 `: e
window.onload=populate- T$ p) f2 j# [4 r' k
! c& |; D# d9 y
function scrollmarquee(){
3 r* p, n. g  a! ^( R( Rif (iedom){8 C& @" D$ A& r  s7 K( X4 K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ v5 @* N. u- J/ v5 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( T# s0 V2 O9 ]( c# L$ ~; N; c
else
3 q* k. |) `0 G( a5 {! Across_marquee.style.left=marqueewidth+8" a% P4 r2 [& R4 ^- G$ y  k, ]! J
) _( r8 F) I* p% b; l! n& y
}
! }9 }: F  ], Helse if (document.layers){
, g$ l; ^( {5 j( W) T& f" R9 ]if (ns_marquee.left>(actualwidth*(-1)+8))$ R4 w' H1 V1 @: S7 ~" a4 A/ |' g
ns_marquee.left-=copyspeed
% }3 m% x9 q+ V# ^5 Yelse
% O+ Q$ i, G" h( Gns_marquee.left=marqueewidth+8( G' F; P2 @3 o* b7 P7 k
}
; {" q, [0 {8 i( D7 L- W" @2 j}
7 \; l; e* v. w; f' c" l
  @1 x2 v" `7 f7 X# j  `$ J5 Gif (iedom||document.layers){
, v' X* C( V+ T5 v# Rwith (document){
; s1 \: ~% h" n; E& z6 m7 a3 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 E" Y: S) }# @
if (iedom){: B! }( _7 T  z" Y- j7 D+ |4 U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# \# I  O# L8 Y4 }, Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 o9 T4 @; q% h0 Q$ V7 Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): s/ `# q' p& l, p5 J
write('</div>')
% @; \6 l: I* ]# x# a}
5 \  D% u* T" a3 a/ lelse if (document.layers){
: J7 s2 ]5 x. hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 j, L7 l5 h0 f* lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 w( I6 d* c( K! c8 ^
write('</ilayer>')' D% P1 I! n/ Q  D; }$ T
}
' R1 [" p% y" f2 cdocument.write('</td></table>')
: M" c9 ^/ U$ ^" G5 C6 L6 M}
  G8 p& ^$ F: k% g; r}- ~/ ]% b, G7 s* c* Z' }9 ?
</script>

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