返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 Z, r4 l  G, a0 f" ^/ R
var marqueewidth=300- P4 _9 R  D( e  v1 m( Y/ o  b
//高度
" P" H& [# `, w& P, R6 i: pvar marqueeheight=25
. U  K, Q  d+ t2 {% C' u8 @//速度(1-10)9 ^1 @; p5 }. H1 D9 `
var marqueespeed=3
5 p% W* Q' m. }/ X* ~//背景颜色# {1 z# v  Q0 N9 J$ z
var marqueebgcolor="#FFFFFF"4 }+ Q" T( p7 a  a
//是否能暂停 (0=no. 1=yes)?
9 u- g5 I# g# i5 Lvar pauseit=15 b: y1 L0 Q0 U) P* R- \1 V
! i7 p! C. n2 |% l$ f' V( Z$ g
//修改显示内容
% K' m/ f- y9 M; u- evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ U5 m3 p& f0 U+ f' b
. @$ N: D: _, F( e
0 j9 A4 t" N( W2 E////下面不需改变////////////
% e4 w- d6 U. b7 j6 e$ A
( X6 C7 O7 o- G8 F: [/ svar copyspeed=marqueespeed
9 h1 E: b3 _) P8 X) xvar pausespeed=(pauseit==0)? copyspeed: 0& E# l2 K8 n( a5 r$ @# B+ `+ h3 D
var iedom=document.all||document.getElementById2 E% P; W# |* s1 o, C
if (iedom)
  Y7 w! S6 I. @: X# [, t' p1 {1 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ E% x5 u7 z# E5 V+ O% O. Vvar actualwidth=''' B) O$ i+ O* y7 v5 R( ]
var cross_marquee, ns_marquee
8 b, D9 i7 m( w4 V5 @5 ?1 f# k* ?) r$ w& B
function populate(){) o9 G5 {) L& e) F" h
if (iedom){
+ u6 H4 k. b4 c% `0 ]8 @! Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  I6 o. T$ T" a! a7 I
cross_marquee.style.left=marqueewidth+8; g) t5 L+ A4 S1 c
cross_marquee.innerHTML=marqueecontent" Z2 b  _# n0 p$ d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ J6 M. a( W7 s5 t2 x) t3 y1 G0 Q- c
}1 G! @. _& A# m" z/ C' q: d# l
else if (document.layers){
0 a; e+ v2 y7 t6 l0 |! k: Z, {ns_marquee=document.ns_marquee.document.ns_marquee2
) P. O# D8 }( B! a/ r8 \4 L# h( Vns_marquee.left=marqueewidth+89 T' p4 e% d  }) ]9 D4 c2 I- k
ns_marquee.document.write(marqueecontent)
9 v7 C1 T% {1 W+ dns_marquee.document.close()
' Y9 y. k+ |+ l8 R' \& o( z! Z8 Lactualwidth=ns_marquee.document.width
+ U  _) `0 I4 Q' \$ _- l4 d: H}" k) `0 i/ r. [1 w+ Y
lefttime=setInterval("scrollmarquee()",20)
4 r* b' h# y, Y' A& w1 O$ V% w}
6 E- R4 I! n) Wwindow.onload=populate
0 E* r* q  B, ]+ C7 r1 o9 W) x
+ n  K# Q' f' E2 k# |function scrollmarquee(){6 _+ p$ V" @5 R* `
if (iedom){
3 Y0 v. c1 @5 s  u0 {/ Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 b7 L6 D. h5 W0 A% J4 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 }6 S4 L  Q  K, H2 T: ielse
5 S! q( E9 z5 ]# N2 [/ s7 ccross_marquee.style.left=marqueewidth+8
0 z; W: W) d! |  h- v  ?5 M3 z4 W- M/ I- k
}, o* n  t7 L1 p5 r1 l
else if (document.layers){
+ c5 f9 z8 G& I5 l, e, zif (ns_marquee.left>(actualwidth*(-1)+8))) l4 |6 k4 X3 B% U( k8 m% o
ns_marquee.left-=copyspeed( O: W/ }) [# X
else8 U# W1 [1 m! `3 j
ns_marquee.left=marqueewidth+8( p9 {* v6 ]8 a. h  q
}
! b& {$ `0 V" @8 w; d' a}" L$ w- u' G! [* z
4 E( J7 J% p( X7 @' r8 w4 b& f9 R
if (iedom||document.layers){
, m1 Z7 g9 ?& hwith (document){
3 g# o  R2 G0 v- L/ A# a% `- kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 p  y& d( Z( T/ p- T2 v7 I, [+ |
if (iedom){
: i: Y# J4 B9 L; {8 X$ k5 ^) V. Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* `- M# J3 p# R, `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). g% s( s9 D$ x) i6 Q- [: z. ?: U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: p, A, a8 t* g: N/ \write('</div>')& `5 z/ J  {" a1 \, y9 J- ^
}
; ?# \5 {8 u$ C( A+ `% J1 z1 gelse if (document.layers){
' Q% U0 r$ F2 `6 |5 e% [* Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ S0 n4 n! K) A" h, T, f  xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 R- i  ?/ B* ^9 h5 `) W) swrite('</ilayer>')
: K" a; |, t* T}9 M8 w8 p$ k7 `
document.write('</td></table>')" i9 ^' b, U; T; c
}
+ f8 C- r$ n- |; Y; N}
/ C+ e: V3 {6 v" h5 `2 j</script>

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