返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, Y  f7 g1 i! q( `9 ~var marqueewidth=300
1 F( }) w' _8 s( a3 n  Y5 e//高度
5 d* C5 N% w% n; Q0 m5 W4 B# f7 L% nvar marqueeheight=25
: c- j/ J0 a% _//速度(1-10)
$ C$ h* d' N. o: Z8 W5 evar marqueespeed=3# c- ~7 x8 ]2 f
//背景颜色
# k; t0 F1 Y7 t6 J! ivar marqueebgcolor="#FFFFFF"
0 p, P! k. h( K' j$ t+ V//是否能暂停 (0=no. 1=yes)?
3 q' j( E5 A4 \4 F% Yvar pauseit=1
4 H/ ^- X. Y$ t! U' {# A$ M
: x# h& ~- m9 l% B* X//修改显示内容
) Y2 O0 G, J+ N% `- K$ C) x8 pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( B0 v: ?* _9 {# k: a
* [/ M4 s4 S% Y- a" z9 i
" ?) v, S" O* Q////下面不需改变////////////; N- H% s" y9 o. A* d

6 K# K! F( y/ pvar copyspeed=marqueespeed, `0 _4 Q3 _( H$ o( a
var pausespeed=(pauseit==0)? copyspeed: 0
0 f; ]4 o9 j( i* x  ]! \. E* Fvar iedom=document.all||document.getElementById
* y! L4 E4 P) d$ F4 i+ y& Dif (iedom)
' K9 X! O! Q9 w8 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) J8 M$ p/ |; b2 ]* Pvar actualwidth=''
2 _5 c+ u- i. l: bvar cross_marquee, ns_marquee8 h  u: \- f" H/ }

4 ]- q  w) `$ x. X# I+ T# h- pfunction populate(){2 X1 f- t/ N3 v# U
if (iedom){$ Q2 B2 j9 P1 }* s) k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) l" T, V# Y: {" T9 c/ t1 X
cross_marquee.style.left=marqueewidth+8
+ l3 j* U7 C8 ?6 }/ N0 ?7 [: D" ucross_marquee.innerHTML=marqueecontent
  f7 `) }9 \* pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 N( }1 F+ F2 \4 j. H/ b  C( s}
: D/ Y* c: q3 X8 Felse if (document.layers){
# g! r3 D+ {! c* `- `' q! Nns_marquee=document.ns_marquee.document.ns_marquee2* a( B, J# e( H: t
ns_marquee.left=marqueewidth+8
, Q3 `$ W1 t( ]& a$ k0 T! d8 ans_marquee.document.write(marqueecontent)) s" `: L, |" ?% o+ a* v* ~+ w+ H
ns_marquee.document.close()& P0 o1 j8 O: D( f; d# ^; ^5 f
actualwidth=ns_marquee.document.width4 P( Q% Q$ @( @5 [( j- C
}
. F4 L- q0 N# vlefttime=setInterval("scrollmarquee()",20)
% B  X3 C1 f( s! f6 J+ w6 Q}
9 n  t1 |+ Z0 Ywindow.onload=populate/ c' x3 B% H0 t! ?' x9 V! h

% \: h) j& {2 dfunction scrollmarquee(){/ L8 @3 R& H  J2 i5 s( H8 H) i' f9 X
if (iedom){8 |$ z' L3 D8 f$ `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 ?, Q0 Q0 }1 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 h. _, T6 f( [9 `: ]' t$ w/ ?
else
( @  Q# |( _+ I, e4 mcross_marquee.style.left=marqueewidth+8
6 b' ^7 m! U$ `7 b3 a
' n' x7 l3 G. ?  |$ J' t/ n}
7 f; M8 b8 C3 K' ]) {else if (document.layers){* Q6 S% @: W4 S: D' F- Y+ M- B9 n9 ]
if (ns_marquee.left>(actualwidth*(-1)+8))  s3 e! J) D. a0 Y3 ], q7 y# }
ns_marquee.left-=copyspeed& G! Y  _2 S. b' Q3 _& F! U
else
: c# J3 N3 s6 q+ E' pns_marquee.left=marqueewidth+8; Y6 h, Q6 ]5 W9 S
}
  g/ n; A' b- R9 c}2 W' P( h2 O- W0 n* s5 H* L; R* F

( O2 p% N% f7 T- Q0 }+ ~if (iedom||document.layers){' B+ w+ y/ @! [, Z3 f
with (document){% H& [! I& j" m: p# [- a8 e! B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ X% i8 c$ d+ |/ E2 A
if (iedom){7 g. B& B# Z2 q) Q) h- {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- z$ c9 h7 l: e3 N# ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% X7 E: [. y; k' ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ H2 E# C- S. y1 P9 vwrite('</div>')- P) g! g9 Y7 a: x1 c' ]* |0 d
}
& X4 b) [$ g" w( ?else if (document.layers){
; h, l8 @' P' ]4 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% T2 o4 l, T7 s4 P& H+ X8 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* d- H* A/ w- `/ M4 u( D; c
write('</ilayer>')9 g% K! j0 C" j- F7 s! |
}
8 [% O* p( p6 Udocument.write('</td></table>')4 _% u( W3 i2 G2 D5 P
}
. R' E* ?# a0 q; q$ S}
$ k# p7 ]8 l' o% ]7 Q</script>

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