返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ ]0 ]0 X4 Z% ?+ W, Z8 Z
var marqueewidth=300
6 X. M" @" g* E9 D# W//高度
# F+ V' X0 E" c5 }* M9 ]& W/ lvar marqueeheight=25
" S; m! g1 c! @9 [//速度(1-10)" i+ q# F' W( I2 z- B" Z% Y
var marqueespeed=3
( N* @3 C6 @. t2 h3 I4 ^( E& }2 k) u//背景颜色  v$ |) T! P' E" B% r8 X4 |0 q5 F
var marqueebgcolor="#FFFFFF"
0 q/ _1 p" U' d6 v, }' N//是否能暂停 (0=no. 1=yes)?0 l+ [" O4 `. t5 y! m3 |& p
var pauseit=11 O/ b% g: M$ ?1 A# H. z+ }

9 q/ }2 A3 ?4 @% E//修改显示内容4 p) l, \4 J8 F9 a$ @$ ?$ Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 }; y* k  Q0 D; b+ @& ^, i$ Q1 `- c

( g! ]: F) m0 d$ R1 C. f7 D
" ^& u/ c7 v0 z6 {1 Q! t* d: Z////下面不需改变///////////// c& y3 D1 k. T$ M& ]9 y- {1 {
$ H# k! }; Y6 ~
var copyspeed=marqueespeed
% ^0 P: R& U# P! S* Bvar pausespeed=(pauseit==0)? copyspeed: 0) _/ K* }$ z) e# T8 C4 t' c9 O( ]
var iedom=document.all||document.getElementById
3 }9 W" E. v, D0 X( eif (iedom). W5 a; ?$ E; E: z0 y( ~& [7 Z% Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ b3 ?8 r8 F9 l5 E# w9 b6 G
var actualwidth=''& f( v5 `1 Z  T* F( n1 }7 }
var cross_marquee, ns_marquee
9 N3 N* a. l5 L
  Z' @" O& J, X* [function populate(){
$ \+ L( R- T% b, j0 Vif (iedom){- R. B. X; A4 |9 Y9 x. T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 }: j1 g) x* x! `5 |7 `; K
cross_marquee.style.left=marqueewidth+8
; ~' y: e) e/ C" g! W6 _, T0 _9 bcross_marquee.innerHTML=marqueecontent. B) }* l! P  V0 H2 f9 L6 e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 c+ [; f4 C) u& m}, g6 A7 j" z; d$ L
else if (document.layers){1 o& H9 Q- ~9 U; h. q
ns_marquee=document.ns_marquee.document.ns_marquee24 `8 @( R* ^1 K2 n1 J5 k  D) B/ N  c" P& O
ns_marquee.left=marqueewidth+8
4 A1 y  |) p3 `9 m: Uns_marquee.document.write(marqueecontent)8 m* J( M. H" |
ns_marquee.document.close()
5 t  Q# Q) _# u! J$ ?; xactualwidth=ns_marquee.document.width
) ^: s' c; A( D! H. {1 k}
0 Y2 n0 U- Y) n' z( u3 u' glefttime=setInterval("scrollmarquee()",20)
! b4 g# P9 m: R4 m}+ G% i3 f+ g6 m) m
window.onload=populate
/ R) o5 c/ ]5 K2 h& M& s. Z8 b. L* ^5 d% S/ `4 c8 P. n. H
function scrollmarquee(){
  {  l$ S; G4 q5 D' w' G" a/ H0 V: gif (iedom){( n  t. T1 o; Z2 }0 i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* r' A7 a# d! v, W. Y( Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 R: K$ r" [" ?9 lelse
  r4 _3 S( `1 }. tcross_marquee.style.left=marqueewidth+8
( F$ A' V1 p' ?* z6 X- l; r8 e+ K* v" ?$ L* m4 I2 D* z
}3 m4 o- [& e- x
else if (document.layers){4 _9 d5 j- U- c2 G: @! q: F# W
if (ns_marquee.left>(actualwidth*(-1)+8))
: L2 l8 Q& z5 d6 P6 R, \2 ans_marquee.left-=copyspeed
& l& N7 ^: D, m) Q, u6 |else
% R$ G  e( R9 ~( \* k% lns_marquee.left=marqueewidth+8. v" U! n# z2 M
}
# S  p1 t9 x$ H}+ S% ~9 J" b  B' m
/ H( a% u/ ?+ m
if (iedom||document.layers){! V+ z( y: V; M9 w8 l/ L
with (document){# s  v# i' [9 w0 z: j% R; O. L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& \/ x1 l2 c1 H! y9 {) mif (iedom){
: W$ _  {. |. o. p8 J. O2 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; Y. o5 Y* |7 l- a2 J* c3 K) swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ E) y5 Z3 N$ w- w. Y8 _, V% B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ x6 g' k+ ^" L2 H' nwrite('</div>')$ ^! n$ A% n5 @2 \0 {
}
7 D% M8 {  e0 f5 D) Z2 K4 O5 E+ uelse if (document.layers){$ D$ _0 u, M, S: ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 ?, W& }! x$ f- @- swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): S( @- K9 P: R8 h
write('</ilayer>')% j* P1 }% p& L% F$ w& T
}5 k, j/ r; S8 J* L* u
document.write('</td></table>')# y2 H( Z8 G$ I& d" t; e
}
6 J/ \8 N3 [9 D, S}
$ T* ]0 H' a; y+ H</script>

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