返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ @' F/ q* q1 F: @, h1 ]var marqueewidth=3005 p( b( @" Y) E" r  q' p; e
//高度
7 a1 F% h# M, X0 {, q! Bvar marqueeheight=258 p" f/ G+ \; E/ [7 b
//速度(1-10). S& _; f( r0 ?% W# U! n
var marqueespeed=3: B% j+ u4 y* n4 H/ ^6 L- s
//背景颜色8 ]  K0 c' S/ e9 k1 a# n
var marqueebgcolor="#FFFFFF"
$ _4 a# w4 W' [+ p. l//是否能暂停 (0=no. 1=yes)?: ^! S* s! p* a. @0 ?- B' ^
var pauseit=1
8 q- E3 Z7 m" s9 r9 _) [+ ~! D! X
//修改显示内容3 E$ J( V6 _8 D( a5 B  O9 Q& F1 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 x2 v5 n/ s1 B3 P

! W, L5 F  A- t+ U. g$ A( p( C* s( d3 y8 t4 B2 W: X
////下面不需改变////////////: M8 t9 p7 y3 O. F

) d" k" x8 g4 G+ V7 F0 W" S4 fvar copyspeed=marqueespeed
$ g* s+ k% T- d3 ~var pausespeed=(pauseit==0)? copyspeed: 0
2 H! O7 q! }+ ]var iedom=document.all||document.getElementById
: {; w; \. S5 J6 z0 ?if (iedom)
4 y* a' S( [2 A) ?- |8 Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! n9 D* M* a/ I, g. i3 K& Kvar actualwidth=''
4 f; t7 s" f# \3 [! hvar cross_marquee, ns_marquee
- L: W" M  C! s8 d9 y  ]' j% `8 w  X5 i6 A
function populate(){
# M/ N$ X3 l8 c. C3 |% ^if (iedom){
: i9 f8 c% Y9 ?: l* Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 ^" a: \7 s/ q& m. scross_marquee.style.left=marqueewidth+80 l5 ]$ F5 V& k! a0 @( g2 }% [+ z
cross_marquee.innerHTML=marqueecontent
) Z7 \% l% i2 f: l8 |' C  oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; l2 Q" _& g  D7 X6 j. d/ U) i+ k7 H}
2 h1 X$ g) O* F5 Oelse if (document.layers){; g7 ^$ ~  L3 @+ U  C. D4 \
ns_marquee=document.ns_marquee.document.ns_marquee2. i) k: ?) d& @7 q5 [+ E) Q& k
ns_marquee.left=marqueewidth+8
/ ~8 K/ w. R( e) g8 gns_marquee.document.write(marqueecontent)
# N2 x+ n8 z+ o8 q/ ens_marquee.document.close()& I( j4 U3 }8 ?. T" ?  E5 H* |6 E0 R! G
actualwidth=ns_marquee.document.width9 G; o) i5 S& K
}
% a- B# V- t1 j- {) L2 _' v! I! blefttime=setInterval("scrollmarquee()",20)
* o6 o9 P2 k3 s  w+ Q* v1 ~}  M8 v- X$ g' T" k8 M$ o
window.onload=populate) ?- ~( U0 f' ^7 U: U
3 h0 p! v2 t6 N* E
function scrollmarquee(){" K. T/ @4 M0 @: L
if (iedom){$ f! E/ S* e: |% i3 M- h" b, a; m6 L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 J" d, X/ R' @# v* M, b& W  a9 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 I5 T; g8 i9 O  R" @
else
. K! s- `" z( P/ a2 Qcross_marquee.style.left=marqueewidth+8
8 R1 w* }7 i9 T" z: [1 N' b% y8 t' x/ Z% y# q& q
}& R6 E) l4 T1 C/ f* e
else if (document.layers){
. y" N* d) d5 uif (ns_marquee.left>(actualwidth*(-1)+8))
) q, A7 z+ A% V. M1 B: Q) Jns_marquee.left-=copyspeed! i: O- v. ?1 l" H: s
else; X7 y. i4 {* }
ns_marquee.left=marqueewidth+8/ y" H6 \: G) t- n- R4 M
}
9 m' s1 T3 z. G  M0 Z}
% r% f+ e5 j& ^7 h+ B0 A  }# z
& h2 p' l# |6 e9 h: j. e/ uif (iedom||document.layers){
9 @" n9 p' P! }6 awith (document){) D3 K9 w0 S$ b* i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; L1 e" V3 ~; M' v2 ]: M5 o3 ?if (iedom){
, O- y0 A! q  Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ o3 ~; P2 v& ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 w% ^6 n( `( l+ J$ k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# Q: g! E8 b! x! Y% w" P  q
write('</div>')0 h* R( D% t$ l2 v4 m8 Z1 u
}) D& S* F4 v: |7 I/ m# i; D3 j
else if (document.layers){* c2 Q; |) M4 U# w6 e+ M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& x% I& q3 W, z6 e* owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) F* b% |7 J. H. B  X8 A9 Ywrite('</ilayer>')+ \- z. N1 |: U7 x' i$ a
}
: t3 z7 V, @9 `; d& mdocument.write('</td></table>')1 U  f) W& p1 g
}5 l1 o" |$ u. G
}& O. T  e# }7 x8 z' c4 E8 J
</script>

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