返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 u  y- T3 y, A0 r; I! F0 t
var marqueewidth=300
1 o/ b3 u: J" D  V//高度; ^/ W) W5 a6 l2 T$ n- N# d: e
var marqueeheight=25) b( n. ]9 c0 R* i
//速度(1-10)/ Y5 }4 J" d6 M" S7 K0 G
var marqueespeed=31 h3 \" \6 p# M
//背景颜色
; c; u; X3 C, M7 Kvar marqueebgcolor="#FFFFFF"
; h0 z3 R' j4 Y, t% J$ _) V! N//是否能暂停 (0=no. 1=yes)?" E! c: L7 e( Q3 K, T( {* m
var pauseit=1
4 N+ L0 v3 d6 I3 v% M- D6 ?* p. t: l5 |! _1 Z' \' i) h& W; y$ q+ A# ^
//修改显示内容1 Y5 \* e+ f. [0 n1 N! g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 S, |, ~3 Q5 O) U# c  u; `3 T& b) B8 G3 \; e, n; r2 N

; d4 A" j; ]6 L9 P! a: T) j////下面不需改变////////////9 z7 A  S8 I/ e' I  r
( t2 H  U! X8 s+ t
var copyspeed=marqueespeed
) N: r6 b/ @% D7 e. z% V) Zvar pausespeed=(pauseit==0)? copyspeed: 0
" n1 x, ~6 K4 {1 Gvar iedom=document.all||document.getElementById
( X' J% E0 _6 x- d  ?. Zif (iedom): l/ M; o7 @' g. R. }. j- p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 F% u. o% R8 e* y* S8 evar actualwidth=''
2 R# ^. e$ p) U2 G- U1 P# }var cross_marquee, ns_marquee% {: m8 T; W( d- k% l
0 g/ M6 h  k3 P6 {( ~3 q* M' }
function populate(){
4 k- Z6 H9 Z; H. g6 D; [if (iedom){
$ A+ C/ a: x$ d  l; B5 J- ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% X, d+ W1 T+ B% }, e7 g* W2 X
cross_marquee.style.left=marqueewidth+8& o* i) n5 P8 ]" ~: j8 z
cross_marquee.innerHTML=marqueecontent
4 x$ g! L' A1 g5 Q6 b* Z0 Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 l7 D% ]( I( L/ o* @
}9 l8 k9 O# _( S$ g' X! X$ J# Y
else if (document.layers){
4 y: y% O( C# n3 Lns_marquee=document.ns_marquee.document.ns_marquee2
, r7 w% b: C/ f& {ns_marquee.left=marqueewidth+8
- Q) U2 i, Q( i* jns_marquee.document.write(marqueecontent)
1 g7 T, p' [# \  A. fns_marquee.document.close()
1 e& A/ P/ t! K' |actualwidth=ns_marquee.document.width
' D5 ]3 Y) c: `$ G8 P2 u}1 B' j7 X, F! V# R! ?
lefttime=setInterval("scrollmarquee()",20)" @9 k, Z& N: U
}
; D$ ~  A3 `8 [' Qwindow.onload=populate
1 n3 U- B; w$ R! T5 Z6 L4 `) b* _/ C
function scrollmarquee(){' i& {. E" q" i( n, G: r
if (iedom){
. K' j9 _  ^- w# dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: V! m7 V% ^; `9 h0 x  W5 Y! |8 bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! H( z+ I, u' F1 g5 celse
# P" M0 G* K# f* F6 b* ]cross_marquee.style.left=marqueewidth+8
  [) O: e4 R" g9 n: t; O/ I  h
/ U) Z6 f- L! }}
/ Q6 Q+ G5 G0 Xelse if (document.layers){
/ Q4 `5 a% j  S3 W  @0 h) M) }if (ns_marquee.left>(actualwidth*(-1)+8))( m; L& b8 c5 p# I5 [
ns_marquee.left-=copyspeed0 G9 S' s3 S+ G9 U! S3 |
else3 `( _% Q2 l# N' G0 {* _$ r  d
ns_marquee.left=marqueewidth+8
8 h+ F% L0 O6 d' D2 n}; R8 u, |2 w/ Q8 e
}% c) ?6 c& p' M, U6 Z

8 R8 _  n( q; q0 j5 J8 Nif (iedom||document.layers){1 L3 w4 e, ~& W0 L# A$ T4 S; x" `9 G
with (document){
* p. l+ q8 Z8 \$ c5 rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  o6 i8 Y- N4 {, x/ \' C& F/ S
if (iedom){
" \& h3 j. |- L( qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( C: t' q+ ^& U6 S5 B$ W3 L0 q, Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ W, q( n: f/ y& U* kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 ^2 \# }. J8 N, [; `; w
write('</div>'). h1 S/ Z5 R; A9 |3 r: }; _
}
6 ~# x& t) p, K, i; X7 S0 c9 M- h0 Celse if (document.layers){0 c! x9 k- z- v9 M- [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* P$ n% z) _" k3 ?: Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 M* _: a9 K% b- G3 I" U7 gwrite('</ilayer>'). e# [# H& `. Y$ ?4 S- `! q$ I- K: O
}
2 t5 w: I9 q1 Z+ }% u" `! t8 o2 E* r( s! Gdocument.write('</td></table>'). D# X# D6 r9 }2 U  }
}/ e2 e: @' U0 Y! L/ B6 n; b) K: S6 u
}1 g4 g0 w) N# Q' \
</script>

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