返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  f, d. e! m- ~5 ^- D  _var marqueewidth=300' I# b2 x6 @# h, _
//高度1 M  a- Q! ]) ?( K: h0 F5 D; B& h4 y
var marqueeheight=25
: \5 r  {+ D" s2 G& |4 \//速度(1-10)- t' k% s+ u. v
var marqueespeed=3
5 f1 v: p! D* k" ?1 _. H//背景颜色
$ p4 L, g! F3 F( }  i; Zvar marqueebgcolor="#FFFFFF"
8 b1 h5 E+ Z8 E0 u//是否能暂停 (0=no. 1=yes)?! f# n2 y7 e  n$ M9 S- M0 c
var pauseit=16 D" Z2 |! Z1 ?+ k+ |: r
& j8 K* R/ k/ b2 i1 h' ^& e
//修改显示内容
4 F( T% v* h' v! R& Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 V5 T/ r* @8 \7 M) ^* K
, f9 d$ k0 S+ E3 v" Z# K
5 V, g$ i9 y! I0 h
////下面不需改变////////////* |7 a4 E1 d' J5 G4 x" @3 N4 H

6 G7 V6 q# c1 W$ l' J3 pvar copyspeed=marqueespeed2 e5 |, c7 ~& F' l. |
var pausespeed=(pauseit==0)? copyspeed: 0" Q3 |* W8 \; I% i- I/ ?2 {
var iedom=document.all||document.getElementById( i. f2 J' N1 o3 t
if (iedom)7 [. d. X% J3 G& j) W1 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# g: v4 k6 ]5 ?! B+ A7 V' e9 U
var actualwidth=''* z3 }# g  Q; c  |9 S+ N8 @
var cross_marquee, ns_marquee
/ s; b, h" W7 M9 e8 @  j
' p! f% c, _7 q! P: b: n! {function populate(){$ k+ G' N. w; s8 C! j
if (iedom){: d8 B2 }5 A, {. E. ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 a8 G+ P- f* U( I
cross_marquee.style.left=marqueewidth+8
& M" z9 I8 v. M! ucross_marquee.innerHTML=marqueecontent
; x  c: Y( U; Q9 l" x, s+ tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 K7 v- g# d1 ?- O# F. W}4 o+ ]/ ?0 w) t8 ^6 w' K
else if (document.layers){
3 [3 s+ ^% f8 K' p  j; d: q% b& ]" qns_marquee=document.ns_marquee.document.ns_marquee2
, H: s  y6 Q# y3 h" w" ?4 yns_marquee.left=marqueewidth+8
* H! Y2 y6 y. Bns_marquee.document.write(marqueecontent)
# T; C$ b7 _, T0 X& B; m5 O: Nns_marquee.document.close()2 P; ]/ i, W8 j/ h$ L
actualwidth=ns_marquee.document.width
* U% ?$ t. @# Y4 N}
' {% p: D( z, E$ S( ]# j4 ~! O- k2 \lefttime=setInterval("scrollmarquee()",20)) f$ p6 G. R7 Q' f' e# U8 z
}
' }/ v+ Q$ R3 u9 e% ~! Ewindow.onload=populate
0 \  ^1 f2 H& G" K9 P6 f1 L
7 q4 G, I7 @, i1 A9 z( L8 efunction scrollmarquee(){
2 N0 N) U8 y5 w* j1 Sif (iedom){! b2 Z& u, o5 w+ t+ `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 q# ~' E. X( w' y4 l: \+ T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  M/ ~) q' P  F; Welse/ a  T  h! D" @& Z( E, I
cross_marquee.style.left=marqueewidth+8
1 V. B! }) f, `1 d1 `; C% Z+ u) a9 d" K1 w# n
}
9 U; Q1 m- P+ b* P- U5 i  yelse if (document.layers){
. Z6 i* G* D0 s. i6 I1 `! gif (ns_marquee.left>(actualwidth*(-1)+8))
- T# U2 L4 h- J+ G% Fns_marquee.left-=copyspeed
1 P0 |* T3 {& xelse9 H0 ?8 M- x: U2 F9 l6 e
ns_marquee.left=marqueewidth+8
# u7 T1 s. L; T}6 A% L- @& l3 }0 e/ t: z$ O
}
# c! r: n. @* h9 I4 L. \9 ?$ e: H# D) u/ M6 G- P! _
if (iedom||document.layers){
; p3 H; }7 W: e% X! \4 p  Mwith (document){
- E9 [( z* P  Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 K; M# N! l; P. ]0 ^+ w# a  X
if (iedom){
5 M9 N8 @  b- x0 c, i6 X( Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 e) g4 V' ^# p4 y7 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 ?1 Y- e2 c1 `3 U! [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- u* U2 L$ A4 N4 X- h' i0 w4 T
write('</div>')+ l! M) I  \' d9 Q6 y7 _
}
- v* t. r/ ]. z. m; x3 K/ q8 uelse if (document.layers){
, x9 i6 n& `4 P' ~9 D" d  |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( T  r: b" I9 C) g- G  Y6 R% U) Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( N# Z- t0 @1 _- e$ fwrite('</ilayer>')
, V) K1 s; p' ]% i4 z; q- l* p}" \0 E- G3 |% X; n1 O
document.write('</td></table>')
; j0 P. O* |( Y/ `}
" u" f2 i1 L+ d' c  O% Y}) n$ X" A4 q2 I* E# x
</script>

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