返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 l. h3 h, Z1 \1 v, n3 w
var marqueewidth=3007 j' \! m2 D$ q8 ~" O
//高度
: k2 L7 E$ N8 `' ~5 v* K0 ]var marqueeheight=25
" @2 n; b- R# C1 Y# y//速度(1-10)
' w+ h7 `( Z- N3 `6 d* A0 svar marqueespeed=3
1 Q( i! h3 S3 P7 \3 T2 t% W//背景颜色2 Z; `+ v! J  G0 w
var marqueebgcolor="#FFFFFF"* d1 q' M9 I7 l
//是否能暂停 (0=no. 1=yes)?
$ a8 m1 S" `5 ?' vvar pauseit=1' T  l  C! m5 L7 ~" q6 O
5 _7 T; H$ `0 f
//修改显示内容0 B6 m1 I% E% ~2 b' i& s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* R6 g( l1 j, d3 [( r+ |
9 {& S& G, g3 v" M# X3 E2 \  K/ D+ E/ i. d
////下面不需改变////////////4 R7 m" \* F+ v4 B+ f
  F2 t. e' }/ B$ ?3 P
var copyspeed=marqueespeed( Q4 |- y) Q4 k/ k9 H' ]& j1 G0 m# u
var pausespeed=(pauseit==0)? copyspeed: 0  D4 p8 Y7 j8 k4 L9 C0 X
var iedom=document.all||document.getElementById
1 ?5 a" X2 w* K& n+ J( @if (iedom)
) L+ t0 F" j8 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 z4 X/ ]- d# y
var actualwidth=''3 z& R9 P& x5 q6 P' N' ^
var cross_marquee, ns_marquee
- H9 H, x+ ~8 w% z) e# D& y( w: o' F  p( R/ C2 [
function populate(){
; C. J: M6 p0 |. {, Jif (iedom){5 z$ h4 l4 p& H/ \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 ~0 n0 x3 N8 {; T! r3 b$ e4 ?3 y. b
cross_marquee.style.left=marqueewidth+8
  L, _; Q! ^6 P7 Ocross_marquee.innerHTML=marqueecontent
& w! P3 _1 e( nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 u% M8 s1 @; k7 {}9 T( l; M& ^" m5 }: g+ q7 Z, }
else if (document.layers){2 C+ }9 ~/ Q5 B' Q  `; F' J
ns_marquee=document.ns_marquee.document.ns_marquee2  ^7 |. B: D+ q$ V, |' r' ?
ns_marquee.left=marqueewidth+89 ~+ s* N' r& S* K
ns_marquee.document.write(marqueecontent)3 U, q( ^( A/ a
ns_marquee.document.close()
+ k6 e2 U, h, Q6 c& L' Q) vactualwidth=ns_marquee.document.width- P( G# A  k( X+ D( B' K
}% y! J7 H) M$ m+ y. z; A
lefttime=setInterval("scrollmarquee()",20)
" @) {8 `; }% h  c- S}- L# L/ @2 G$ {! U$ p
window.onload=populate7 q6 D/ P# O% k3 d' B

9 o. ?- d+ |6 p* u4 K8 i: O) a. Qfunction scrollmarquee(){
8 x" ~: o# [' W/ _. ]5 r5 Dif (iedom){
8 C  g8 t! W+ }$ y7 A/ @; Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 p" [$ A: x  C$ O; ^; ?& K1 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! ?9 f( d9 @, {  L2 p; ~# L  qelse
; D7 b$ F9 p7 v8 ?/ P4 x5 Qcross_marquee.style.left=marqueewidth+8+ P0 M, R  i! {
0 R. s/ A/ q7 p0 v! a
}
* x& j8 V+ J4 g6 eelse if (document.layers){4 Y, g+ g' ]4 s: u- H; x8 `* |% ]
if (ns_marquee.left>(actualwidth*(-1)+8))" _# k+ U( X( w4 o! A" ~) A
ns_marquee.left-=copyspeed
) K% Y3 n5 X: j: yelse: y' o4 m/ \* [; `) l2 {
ns_marquee.left=marqueewidth+86 ]( ^+ _- W& B) }  p4 W: J
}
  z" `, o8 E; V}
! \' w5 ]! ]% s3 R' }
2 D! J8 O& J$ L0 @! uif (iedom||document.layers){
; n( a6 D2 t8 r  U! N9 Qwith (document){' W" r7 [# x9 _) g3 n/ Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  }6 \& o/ @% e, z( mif (iedom){3 \' {* v0 c- g- V; O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 t" ]: j1 |! _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 |7 I, v& m& i1 X  J) r6 F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! M3 m5 t8 j: k$ a  V- f- c+ H2 Q& r
write('</div>')
  J" n1 @. ?8 v/ [}! W( Z% S5 \! U# b1 U4 T; ?
else if (document.layers){
9 _( x. i7 Z9 e; |& w0 X- awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 b1 E1 V, t4 D9 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  {; i1 I  c( q
write('</ilayer>')) D2 k! T8 z% y6 b  \# t
}
) Q& L$ p- n, c3 vdocument.write('</td></table>')
! z$ S! U: D* ]- f, m7 l( M}
; M4 M' g. b6 G. l. E& L- K2 D0 X" [}
- M8 O. M  @8 \7 P( o  l# h" W2 B</script>

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