返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ T1 @5 b5 m, w. v' Z7 h0 v+ bvar marqueewidth=300  `% Z5 ~4 W3 p5 s9 g" w
//高度
7 @' ]' v, \4 Vvar marqueeheight=254 I+ R( R. E% g
//速度(1-10)( z! e7 v7 e' E) [+ \
var marqueespeed=3
: u. w. e% _6 a* Z//背景颜色$ N3 C8 o# n% O& p5 M5 s
var marqueebgcolor="#FFFFFF"
; \1 A/ Y9 j; f//是否能暂停 (0=no. 1=yes)?
3 o: q% J% {' X9 V; bvar pauseit=18 h! m5 G0 X8 X8 C7 Y9 `

+ A2 S  o: K! S' C" X0 p: G5 B//修改显示内容9 Z& C$ u* `0 n6 [! ^) O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) ^& F' r6 @; s4 n2 h" E
1 @' e* a0 _% `3 u, [" ]+ h/ q# X% B2 i# {7 _) G3 r) ?
////下面不需改变////////////
( ?- `" D( ?+ r  w% m( K
7 K. v! n9 t2 f9 [+ }  Ivar copyspeed=marqueespeed; W9 L! |' r" [. [
var pausespeed=(pauseit==0)? copyspeed: 0
8 S( {; K4 S6 E' fvar iedom=document.all||document.getElementById& N/ V1 M0 F4 ?7 z: Q
if (iedom)
( {5 p. T( f$ a) odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( r& f( @$ \& M( ^var actualwidth=''
" o; Q4 ]# F' G' _  @' Ovar cross_marquee, ns_marquee
6 ^1 k/ r$ v) e8 I9 A* c" o7 u. V* S, |$ _& R
function populate(){
. h/ v9 R  H$ b. f( w* `if (iedom){
7 d- p/ R- s' K- [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- W$ M# P" p7 u9 x$ |  u
cross_marquee.style.left=marqueewidth+81 ~6 X' N* D7 C6 O" X
cross_marquee.innerHTML=marqueecontent
0 h% s3 X$ Z1 r  O; t8 w, O: r' [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  d! o8 E0 K& m: y" N  V* s9 }}
* @- v( O. K) b& D) @else if (document.layers){
& H6 `- ~) Q. ^! O: @ns_marquee=document.ns_marquee.document.ns_marquee28 h. j$ z$ m% y. H( n
ns_marquee.left=marqueewidth+8+ s7 a' x1 d/ E5 K6 t/ l) Z$ p% ~
ns_marquee.document.write(marqueecontent)8 k/ P. Y* I# f7 ~7 M
ns_marquee.document.close()6 A" g' S$ ~4 i) C6 |4 n/ D
actualwidth=ns_marquee.document.width
0 l6 p) ?8 w4 c/ M}
% _% C5 s+ }( C, Plefttime=setInterval("scrollmarquee()",20)
& \, S* h1 D& F8 i$ _5 U1 K}
0 k) s) p# A& d* S9 ?window.onload=populate8 l. n/ ]- m3 I! F4 w7 g2 q

  ?/ L2 e$ S6 P4 z# g8 Xfunction scrollmarquee(){
  v" [; `9 ?9 V/ hif (iedom){- \& L5 H! N! z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' \9 N2 j* ~- s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 i( F8 C7 h1 x: L: nelse
0 T! ]  h: ]3 W. j4 j! Dcross_marquee.style.left=marqueewidth+88 O4 X) m5 B, V9 I
: ^3 |1 M- i1 \5 {5 ^
}
$ v! p  t4 Y+ x: c" Pelse if (document.layers){( _) P. Z. i: N" u4 m
if (ns_marquee.left>(actualwidth*(-1)+8))
! F- {& K# {$ S, y& V7 _ns_marquee.left-=copyspeed
- ]# U. |  }: ~" e. Telse
7 v  I. ^2 q7 d4 g8 t  gns_marquee.left=marqueewidth+8
6 @* K7 y) R4 p% N( r6 x5 x6 P2 B; I$ P}
0 X6 z0 g" N# g; b1 U  J; i9 W}( V  t2 ]6 @% p6 o% J% l6 U

, F3 V" }% e0 H  ~+ M8 Oif (iedom||document.layers){& S$ H& N' @; x  C
with (document){
- O( E, y: ?( G! u) c; ?! \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" l! I- c" z$ K4 l) X5 f( r
if (iedom){
) o7 C( K- y$ p& _2 Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 l5 t/ H2 s" `0 ^1 C" y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; ?8 i  a8 e& g2 [$ Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 {* ]3 \- I# H! ywrite('</div>')# m5 }$ b3 u. W, P% Q$ ~
}: \2 i: k% j/ @* e$ J; l
else if (document.layers){
9 T1 S$ y: \7 D- J( Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& K: A' D, l0 R+ a, Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): Q7 G2 z" L- K! R8 e# i* G
write('</ilayer>'), a( J5 a9 v; C
}
& s- _2 D4 J0 h8 [8 _) I5 Fdocument.write('</td></table>')
- d: j7 g8 Q- W1 x}
8 V/ w0 n3 c) n" k6 ^$ k, N}, A' u$ w# u: R( I4 z* m
</script>

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