返回列表 发帖

网页之跑马灯文字特效

//修改宽度& U  R" {9 B5 U
var marqueewidth=300; N& T! z# O* E6 m
//高度, V6 t5 ]6 r! N" c# `4 b
var marqueeheight=25
/ o; ~. V% W1 r: O, t* F5 ~4 C//速度(1-10)! H* W, Q1 l, m% C0 Q$ \2 B" n
var marqueespeed=3
, W8 i7 ?  S/ a4 F; `//背景颜色% L& c0 A: B  m- e4 r
var marqueebgcolor="#FFFFFF"  C2 k9 y, X8 B) h! Q7 @0 ?
//是否能暂停 (0=no. 1=yes)?% r! b, T5 H; s
var pauseit=18 P$ _+ \+ F: _! M' X2 n

5 N- G( F7 O. E0 _//修改显示内容
. a+ t: {6 L  u6 s& Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! G3 n2 _+ k! }2 _, ]. C2 |8 r+ h! I# a4 q. x0 ~

1 i, k! h, ~1 K////下面不需改变////////////! n5 m9 G  ]8 Y# c# e! j1 R2 {
5 b! o% I$ l- T+ g* K
var copyspeed=marqueespeed
; l( d& ~% u7 O1 i% Nvar pausespeed=(pauseit==0)? copyspeed: 0
1 D4 @/ S' S; ~- F' P' jvar iedom=document.all||document.getElementById( J  Z; M' [9 F6 c, L
if (iedom)
8 ]5 e% d  |' {/ X$ g2 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, J8 ?  x' A$ O2 F9 [var actualwidth=''
# X, q+ m) L2 i1 Mvar cross_marquee, ns_marquee/ l9 L- b: u. N
; v2 n% V7 `, h) L( X" f- Z
function populate(){  i5 e$ e& f+ ~4 @# j1 z$ P
if (iedom){4 z9 H/ y  b& i4 V2 K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 ~) L6 u8 k/ I: d: e8 ^
cross_marquee.style.left=marqueewidth+8
$ O" X+ Z1 A7 h  \$ y" ]+ ^2 H5 J. ~cross_marquee.innerHTML=marqueecontent5 f# \6 I: I+ `  E9 q3 M+ n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 @1 i8 z% q- J# p8 T}
( l, H7 \4 l+ d+ a! Uelse if (document.layers){
+ U% b) U: X4 \ns_marquee=document.ns_marquee.document.ns_marquee22 @$ z, t4 t5 F( p( {
ns_marquee.left=marqueewidth+8
' s+ q* T' ]' x$ {6 C3 W# i8 nns_marquee.document.write(marqueecontent)2 V" I. C' _6 z" I- g: ^
ns_marquee.document.close()- p& |6 H' `# ~- Z+ D) u
actualwidth=ns_marquee.document.width
- }2 L3 I# U& U. v3 ^}
) K# D/ Y; F& elefttime=setInterval("scrollmarquee()",20)0 J  o3 G, b" Q* T/ t
}
" S. r$ w3 |) B: jwindow.onload=populate0 N5 W) O( {, P* W) }. E
6 y  j' B# F9 ?8 \3 ]% z/ W% r
function scrollmarquee(){& w4 T7 p  T0 q3 ?% `$ a# c1 [
if (iedom){
7 H+ R; b1 v4 @6 h4 ^& u& vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ x/ f/ ~' P/ v8 P5 N. V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. E( X9 l+ [* l6 K2 felse
' \7 W# \: G$ X# {. @, icross_marquee.style.left=marqueewidth+8
! ]" M; [9 j/ a" p$ X
$ {) m7 s( s$ b, ^}- W7 r. L) u; k, J8 E: g
else if (document.layers){$ C1 {9 q: z$ V9 O: H0 @
if (ns_marquee.left>(actualwidth*(-1)+8))4 j4 u3 t# c8 b+ C
ns_marquee.left-=copyspeed
. R5 t3 j) \/ I) Aelse3 W. J( ?1 C5 G( ]6 S, |
ns_marquee.left=marqueewidth+8: b1 O- h+ m0 I- ~* R0 ^
}
# p# |1 a- a1 c% T0 |}
( z, X( Y2 C% c8 r' G" Z, }( R7 b& n% W0 ?; L, u( F, f
if (iedom||document.layers){
4 y! h" @) t, owith (document){
- ^3 a* p$ c/ L- odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# Z& W% s9 C( H' f. M+ mif (iedom){- C/ a2 r- S! @, d& C5 w3 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! ^8 k+ Y+ x% ~( d/ H- dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! f. k* K; C$ a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( Q7 E' z! S$ }8 ]( C/ s1 z. ]write('</div>'); k# M, h: J# r
}
' i; Y+ ?3 O* delse if (document.layers){1 Q% P; ?  Y0 b9 p  m9 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ D* {) D! i& R2 U0 iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: Q2 J& E, s0 ^! @( V8 e6 c5 Pwrite('</ilayer>')
& u1 k* v' [3 X( L}/ D0 P0 ~' ?% Q' P2 s
document.write('</td></table>')
5 {3 X% D7 {. w) b5 k+ D}5 q0 Z" z+ ^+ ]( @0 Y; w# ?7 x$ j
}2 K) G* x2 b1 {8 y' B3 ?' n* u
</script>

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