返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ n+ l8 ^+ g" s) p7 j: x1 a$ u
var marqueewidth=300
; ]' a: p! F, ^* g+ `. w7 v//高度
: z3 a. Z6 {; Z) uvar marqueeheight=25
6 M6 w( [$ I/ r) A: j//速度(1-10)
1 t7 p" N# S" c% nvar marqueespeed=3" o. r) `- y9 L9 Z
//背景颜色
% _3 \: j3 P0 r: ?& X2 evar marqueebgcolor="#FFFFFF"& k& r1 m% `7 c: h1 S5 B
//是否能暂停 (0=no. 1=yes)?+ l1 `3 U: k. P% }3 Y. ~4 }- w9 }6 B
var pauseit=1
' p! \3 U- @; A9 F6 f  l) u# r- f- G" T' s$ B: T, X
//修改显示内容9 @( ~# z0 S! E0 O4 `+ \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 o+ @. K4 @3 f6 Z- |- d2 {- r2 ~: y
6 R+ K  D* ]3 P& @* a  a

7 L" R5 E2 k  Q////下面不需改变////////////
. A* |8 \' t4 V! C
$ k+ T3 A' b  k+ ^! s  k9 Fvar copyspeed=marqueespeed4 A7 ^, Q6 J: x& Y( @9 v. j
var pausespeed=(pauseit==0)? copyspeed: 0+ g  c3 \: k! I! d! B6 u; d6 B
var iedom=document.all||document.getElementById7 j  l6 r" C, C- A  P) i9 K
if (iedom)
8 g$ @# |4 z) J0 Y2 Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! y& W. x: S2 m  fvar actualwidth=''
% o- ?0 G' B% ?3 dvar cross_marquee, ns_marquee
. j$ }, p) e4 a  E0 F- H/ L  S' X
# _! l0 r2 T, e5 D+ tfunction populate(){6 G0 i" A( t& j/ A3 z
if (iedom){
+ I6 h6 z( v( b, L" h' {) y! u; H  Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  n1 Q% O8 O! Qcross_marquee.style.left=marqueewidth+85 x1 U! |, d+ a/ Z  Z5 K, c
cross_marquee.innerHTML=marqueecontent
6 Y" ~9 _; }8 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% \! d& }, j, v; C  H
}5 [+ j! U+ }5 f( b# @+ U
else if (document.layers){
- _9 `2 x& |' h+ j& }0 n; t' Tns_marquee=document.ns_marquee.document.ns_marquee2
5 }* T8 N6 w. x4 [2 ?ns_marquee.left=marqueewidth+8  N% [+ V+ p3 W2 }; T6 T
ns_marquee.document.write(marqueecontent)- j+ l! C$ n" _
ns_marquee.document.close()
' X; A8 S0 A1 V4 y& Kactualwidth=ns_marquee.document.width/ E( a, u& s' `' ?' ?# [- p
}, P/ C3 m/ O# f( w9 z
lefttime=setInterval("scrollmarquee()",20)
/ r" k1 }$ Q+ T2 Z$ {}! [/ O5 L. e5 m' r
window.onload=populate
7 ]. U, o6 }3 ?  \; t9 \
% `4 Q) L& r9 f, N8 M) h# D- Bfunction scrollmarquee(){
" P: T- e& W# G) a$ rif (iedom){. }; |6 d9 p. [. \  u) ]! k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 ^0 O% c% t& x1 Z; a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* o( J  i2 V2 A1 S+ Y4 h( C6 zelse: c3 [7 l- r+ ^( _+ e. G. u
cross_marquee.style.left=marqueewidth+8
$ \& L, M8 o7 s' O1 _0 T8 l
7 c1 ]0 K$ R2 r- H; l}
# ^& F; k3 a8 z. celse if (document.layers){% ~' _0 T, e0 ~2 b5 [: f
if (ns_marquee.left>(actualwidth*(-1)+8)): f; e' Y3 z; L( K: G& H
ns_marquee.left-=copyspeed( y& ^5 g% E7 M
else! H* i  ]9 ?. b
ns_marquee.left=marqueewidth+8; a- M1 u; y+ F, l
}( k- N3 a/ f6 j& r: d
}
0 C8 y( a! X) }# g( v/ J* H1 p& w$ @7 [8 Z+ q
if (iedom||document.layers){
4 k. T5 [" f) G5 v* E! L- Awith (document){5 a9 U$ d1 E$ |% Y2 Q' K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 \* W7 j5 f4 b* F5 ^% `
if (iedom){: |# i% i7 _# k0 ^1 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 i$ w: i) m: e+ Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 w) D+ Z3 B- Z- ^- Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ o  U8 `5 d7 A$ ]* O1 |4 ^write('</div>')3 [+ @* p" s  ]4 C, s4 H3 g4 L' |. m
}$ A" f2 w; {) M7 `4 j+ U
else if (document.layers){6 V( |/ P# k2 I6 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  _3 {9 p% J; V1 \3 N1 ^9 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ Z; J- U$ y) ]$ q. p: ]
write('</ilayer>')! t# c, p; z  ~5 z4 C. x
}$ H% ?: [0 M1 ?. _' g
document.write('</td></table>')
& u+ d; y' T7 k# ?" D, }2 q9 R' u}. C7 a3 G- [# h5 h, ^  U
}
5 ]* S0 |2 M6 m% }" z</script>

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