返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 s, n" ~9 p# h6 W  }; o
var marqueewidth=300  ~! ^6 w. W, t1 g9 H! _
//高度
+ z. k; S6 A" ^" |" b: C/ Z( L) lvar marqueeheight=25$ c8 P; L' U" z  D+ ]5 e
//速度(1-10)+ }) \. i! z2 `* L( w' w; W4 v
var marqueespeed=3
: F4 e% t+ u# M7 I//背景颜色( _* k5 Q% g- n- G) F
var marqueebgcolor="#FFFFFF"
9 e7 W4 s, w9 n* R  @4 y% k$ C//是否能暂停 (0=no. 1=yes)?
( `8 B8 T+ J% R) t/ Zvar pauseit=1( u/ J/ k& N! c1 C1 l, P

2 w) O# ?& g' p5 f0 o4 p//修改显示内容* d* G# V7 }+ t3 E! ?! h6 d# z$ h, z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') M: C  p! U4 L! E7 N* b

% q+ Z& j! i) u. s, ?4 E0 Z
: l$ h1 w# Z. s. f* r6 j7 o; c////下面不需改变////////////0 z% q9 s- i9 T; \6 Z7 ], D; F
6 l+ N# h1 i  N
var copyspeed=marqueespeed
8 Y/ T' ~7 \. i. V* F3 _var pausespeed=(pauseit==0)? copyspeed: 0! S! W3 d: |  U6 R
var iedom=document.all||document.getElementById2 D! y5 k; ~7 W6 U% A& ]2 k- w: l
if (iedom)$ w) b" Q& R7 F; W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& f5 A8 [; `* c* D3 ?
var actualwidth=''
$ v* B/ x  _. q  J& uvar cross_marquee, ns_marquee
- u' w9 [) N' f" P
8 J5 S8 V$ I- v! q0 G& Y  t( kfunction populate(){  d$ A; ^8 E$ u" m5 b& }1 r0 u
if (iedom){
" }- \6 c$ D8 \) N% @: a/ @! }* Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ U( b! G# d0 ?1 B; H- Vcross_marquee.style.left=marqueewidth+8
4 l% |1 H6 {7 b3 D0 P: h7 kcross_marquee.innerHTML=marqueecontent0 c; r( J/ u2 d1 X" k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ W7 A7 B4 o+ e" q}
. U" |" @* b3 welse if (document.layers){; }5 b1 P5 T- ^' h& O
ns_marquee=document.ns_marquee.document.ns_marquee2: B! S3 P1 ^1 k4 g  `+ }
ns_marquee.left=marqueewidth+8; s& K' y( d3 R, `& B1 L
ns_marquee.document.write(marqueecontent)
! v/ W6 {: ^% g( h3 `$ g0 pns_marquee.document.close()
  `3 m/ L% O6 ]& g5 aactualwidth=ns_marquee.document.width
; k& w, [# s6 d8 ^  ~}
0 j  W( L: B' d* R/ klefttime=setInterval("scrollmarquee()",20)& l0 \3 C+ `1 ]& R6 {: I* E
}: ]! @9 `# H$ t% G
window.onload=populate
; f" ^9 Z4 N( w  Y# _9 S7 S4 I! T2 x) t) z3 X2 R3 p$ M, p, m
function scrollmarquee(){
/ {( M8 |4 f4 O  nif (iedom){# e1 q5 z' T+ d' P& O. E1 [/ G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( R8 x1 p) N0 z5 J) _' \. J. Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; m# N* u2 M2 D/ `( p7 Telse
$ m. \; f; W0 G4 gcross_marquee.style.left=marqueewidth+89 p- Z/ Y( Y& P% g
. p2 b$ \/ R4 M; }
}
/ @) S( L' \+ I: }else if (document.layers){! h& f: I; t$ G7 K0 {$ Q
if (ns_marquee.left>(actualwidth*(-1)+8))
* a  l, _0 h# f* I* i$ kns_marquee.left-=copyspeed6 d8 y1 g- L- g* a
else" j1 @4 V# Y9 c0 m
ns_marquee.left=marqueewidth+86 |. x5 h( f9 D+ Z- ]
}
) L7 F: c  l; Y0 A4 K}
- _: U+ M5 p  S
" f  j& [1 }% u$ hif (iedom||document.layers){& ?& @) ~4 K, S- O( ~9 H
with (document){
; N- r; p4 \$ Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 Z/ s' c+ c7 R2 N
if (iedom){) `% l; s+ I9 V7 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( k$ B: d, c% v% u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: ^( Q: P; [. m  E1 h8 xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 k# |4 x8 U1 K% \8 D- v* W
write('</div>')( U0 v0 o7 V# N
}  t# Q) c: G) ~4 O, B# j" a2 S
else if (document.layers){
2 P2 M! p7 i  m2 owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# G) v" k' F1 z9 j: Z' dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, s. u4 k- \1 j8 u# c' Qwrite('</ilayer>')8 ^! ^& x- h9 p# V/ }
}1 _, u. i; J5 X: K3 ?
document.write('</td></table>')! W8 L- u% z6 Z& B9 S
}% C( ~" I6 R8 P5 r4 r1 {  \+ `
}( N2 ?- N5 z4 u
</script>

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