返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. \0 p# T0 s/ ?var marqueewidth=300
# b3 k7 M4 p5 I5 _  Q2 h* D/ C' y//高度
; T, V8 g" `8 S/ Pvar marqueeheight=25& }$ P' P+ B/ B% g+ A$ K
//速度(1-10)
# d; ~6 d2 T9 Hvar marqueespeed=33 A$ \6 q5 X' g1 K5 H) K
//背景颜色, D. r. L) d0 d/ I# r
var marqueebgcolor="#FFFFFF"2 C5 q: n3 S  Y' P' w" O
//是否能暂停 (0=no. 1=yes)?: H4 v; D  |% z: C5 K' L8 Y
var pauseit=1
5 h6 T" X: O5 j8 m3 |4 d5 X0 _/ w8 S* a% b! H/ q
//修改显示内容
  U9 z9 f( ~1 P& A! `' j" }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ B9 x: W% q- W& O; o, V! d
/ N1 \9 q6 ]% G" s6 P* @

' W  T$ u2 i$ }* Z, u: b+ }& K* N, r////下面不需改变////////////# V  f. U& [4 n% q
8 S0 Y1 L( L3 c! R; |4 E
var copyspeed=marqueespeed. \  E) I3 a# R( W
var pausespeed=(pauseit==0)? copyspeed: 08 F% Y' @$ ~8 N9 d1 e, P
var iedom=document.all||document.getElementById+ Y1 |* L' k. T( _
if (iedom): a- Z; C2 l7 v5 [3 a) |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ q# B  j' A  r, U# F3 M2 N7 O( w
var actualwidth=''
* q7 K# b" [# P& ?2 Y% r1 U4 kvar cross_marquee, ns_marquee" g" F# w; n4 O  M- z
# K: k  J7 R( r" I# |6 z9 `& d
function populate(){
" ^4 G# j4 ?. T) |/ ?if (iedom){" g' N8 u9 D+ b3 N% h; V' J5 v3 Y, ]" W3 Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- J: _2 I1 j" K) `cross_marquee.style.left=marqueewidth+8% `9 c: p, a" B) b$ G6 x
cross_marquee.innerHTML=marqueecontent
3 r5 ]! g3 Z8 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 u/ V/ d: q. G0 ^
}
# D  w2 D1 [/ h5 P4 e2 u" Lelse if (document.layers){
2 y. |3 M& _# k( @& B1 \' Rns_marquee=document.ns_marquee.document.ns_marquee2* d2 R2 Q  N3 F3 m1 ?! o3 F! v: n
ns_marquee.left=marqueewidth+8( K5 J& N2 u/ }8 ?" D( [7 y
ns_marquee.document.write(marqueecontent)
! u( s0 s0 k# x$ M. H, uns_marquee.document.close()/ T+ W' `9 F* n9 A4 K
actualwidth=ns_marquee.document.width8 F* M6 I) b, c: p' i- q  q7 ~
}
* z; j3 z  {2 I. X5 glefttime=setInterval("scrollmarquee()",20)
9 `3 |0 M8 _% B- ^9 S! c! y}
9 }: R; P5 I, m2 F6 e4 a$ {window.onload=populate
$ R7 B: s6 s" S
; h8 p+ [# z; ~8 @& ?function scrollmarquee(){
8 [! s; k, T5 ^. f% pif (iedom){
6 Z/ e, k  N- O4 n. ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 u  P2 J6 Y3 \: n) Z+ Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( b* ~4 f! k0 j' O& e' o' V$ Xelse
4 y: U, K) ^9 p9 m& p" r/ Qcross_marquee.style.left=marqueewidth+8/ V9 ]4 b7 R0 |. B& m& h

7 Z! \! c! j$ K9 d' L- C}
7 l. g2 k- a* o9 Kelse if (document.layers){
& ~9 r) g, w& M: Oif (ns_marquee.left>(actualwidth*(-1)+8))( [1 {- d8 k3 L3 m$ V! L$ P) w: s
ns_marquee.left-=copyspeed  h  }3 k9 X" J* x* d
else
" C# b9 k3 [& m1 x, u0 P8 mns_marquee.left=marqueewidth+8; I) t7 L6 \! e9 B
}: u2 w& T, ~9 ~
}
4 H2 Q1 I! D0 @9 ~
+ d0 y, f9 a4 Hif (iedom||document.layers){2 q7 L" ^1 D1 ^, b5 ^4 Q! k
with (document){
+ d2 y& A4 A" e' vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 d+ _% Y% W- _, O( y9 i0 c
if (iedom){
; U6 S  K+ p6 W" K# Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; w- X" G% t4 |& q  awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: w/ ?; S. x: z6 W8 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& s1 ], _, m4 |7 _write('</div>')* D1 M! S, }: y$ ~9 \6 K
}
2 O. _1 C0 h: K  `/ s5 xelse if (document.layers){4 L- z" N7 C' ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 \& C8 V! F' Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; D- p/ N+ A1 q0 ?9 e2 ^' x6 Owrite('</ilayer>')
; G" j; h9 S2 o- a}( l2 O8 n$ r; c/ @/ q1 D
document.write('</td></table>')
" @( M& _/ X- P. k+ y; v! _}; w5 e" L9 l" s4 a! p3 v
}) y7 ?7 |4 @2 V% c# S9 u$ F; R
</script>

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