返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 D3 R# \, f) j, B; s
var marqueewidth=300
# I* ^( a. G/ }4 M2 g* P//高度
- o  K3 M7 Z( z5 dvar marqueeheight=25
* `$ v) R1 c  v//速度(1-10)
% V+ o5 @, A; r7 c% t0 Zvar marqueespeed=3
4 x& R  u- O" u; r//背景颜色
' F0 p1 k/ |" g$ v2 [8 lvar marqueebgcolor="#FFFFFF"/ b; E  l1 }, S8 B! p" D. l
//是否能暂停 (0=no. 1=yes)?
; H' x8 t( f9 ^2 J0 G# Yvar pauseit=1; u& Y1 {. }8 ?$ J$ S
2 |* U" T2 N" ?
//修改显示内容
5 s& Y) b* q! N$ U) r" S1 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# N2 U4 r9 d' h

5 M/ t6 ~+ I+ v' I. g4 {# F4 N# L( h: c- b1 J
////下面不需改变////////////
* O8 V5 d' O) D8 E
/ [9 ~+ n' B% W) F: Ivar copyspeed=marqueespeed. C9 i% u. ]7 A0 m1 N
var pausespeed=(pauseit==0)? copyspeed: 0+ E5 I# `5 l. x5 \4 |* U
var iedom=document.all||document.getElementById& Q8 y2 M+ x# c  ^$ k3 Q
if (iedom)3 Y; [4 y- J& i7 }, y+ @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 b- `) H: K( I# B
var actualwidth=''
4 Y: m4 v5 V* y& Evar cross_marquee, ns_marquee" g" Y+ c8 ?3 z7 j: u

* Y4 u' F9 a5 L$ E& H3 x" ifunction populate(){
9 \* \" ]% C4 [* Q( ~" B  h; Cif (iedom){/ X8 E0 r7 O4 L7 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# F$ ^4 Y, w- Q( P% L* B% n, I' dcross_marquee.style.left=marqueewidth+8% M7 N! G% J! a: L& @
cross_marquee.innerHTML=marqueecontent
  X2 h3 ]4 @0 k8 N* Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, U5 I2 D2 g/ k: ^* `5 [! c( I}
5 ^) F+ b* u1 e. y" y5 p2 t3 jelse if (document.layers){! G$ k( ^1 f8 s1 F
ns_marquee=document.ns_marquee.document.ns_marquee2
+ `6 A7 v; Y, E, Ens_marquee.left=marqueewidth+8
1 s, r/ J% R  A6 Dns_marquee.document.write(marqueecontent)3 V) J+ W! y$ T+ v3 U1 E
ns_marquee.document.close()% \* ]5 N  C: a  ~! b- v2 i
actualwidth=ns_marquee.document.width
# X8 s8 ^! i! a) r}
+ d: c. b5 ^4 `) Blefttime=setInterval("scrollmarquee()",20)
9 C6 l9 p& h- h5 E8 I7 D}
: ]/ y$ L. b2 j8 a' wwindow.onload=populate
" a. l( _: `! c2 k8 _% s/ d! Q4 E' k
function scrollmarquee(){2 b8 d3 C' m# k, l- e! x
if (iedom){4 O% G5 g& A& t- h$ Z( \, r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 j9 `6 m4 d) N3 b( `5 O! ?8 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& E8 R0 z! d& N1 k8 T5 e+ ^
else
1 N% Q& N1 S! ?8 tcross_marquee.style.left=marqueewidth+8
9 }. D$ r0 O' W& w5 v" |
* \8 t7 y: ]0 o3 ~" C}
: }/ `2 i0 g& s- U; R( q" x7 _& m0 }% Melse if (document.layers){- e  X7 M. F  o* I
if (ns_marquee.left>(actualwidth*(-1)+8))
/ m) x* K% p, `5 o6 ~ns_marquee.left-=copyspeed
0 P/ J2 F7 C  Xelse
4 Q4 R1 M' c( ~3 C( H9 N, N# Gns_marquee.left=marqueewidth+8
% a: v" N( ?; l/ H! W" I0 k}( I. k) A  e% _( @& `( n5 A8 O
}$ N6 B! u* F( n6 d- `& j
. w0 O  \& b9 l( S6 h2 h! D
if (iedom||document.layers){) Z4 N* r* p" _* Z; \
with (document){
; T% ?" U. ?; e3 }$ Y; g5 v; odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. V' V' Z2 w8 L0 S; ]8 R  q; {if (iedom){
7 ^* @9 {* X# H2 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ t% j4 R! t1 k/ Z6 \' kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; C( n2 S1 y. g) t! @- a* h0 F( Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! O# l6 o( o+ s! `write('</div>')
( R5 y4 z4 ?9 @, L) S1 p3 ^}2 N% k3 E3 u: o/ k
else if (document.layers){; f2 z" Y# E+ j/ E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: N" t8 w1 X. D( a! }; k+ |4 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( d- O# P; |: w4 V- X1 wwrite('</ilayer>')
! m* r1 p0 T  O9 l}
, F, }& L4 s7 T! G, o. jdocument.write('</td></table>')
6 i/ u# ]% S7 W* r}2 X3 b3 \- {+ l! I
}0 m0 x; t) |# [' s
</script>

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