返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 }) V, f$ H; z  J# }2 J
var marqueewidth=300
7 r5 _' O0 V' N; \& I. F//高度
: y5 {) u  s7 E# ~var marqueeheight=25  v/ p' H9 M0 k9 ]! x8 ~: `
//速度(1-10)2 C3 ]; H, ~. M- s( ?1 ~
var marqueespeed=31 P+ x; m: p0 _( V0 z, x% G. l
//背景颜色
* v3 v) f* o* }var marqueebgcolor="#FFFFFF"
% Q8 ^! `% o9 M- W; r3 i. v) C4 p; O//是否能暂停 (0=no. 1=yes)?+ s. Z) Z; I4 Q1 ^
var pauseit=1! e2 I2 p1 r% N1 t+ ~: [
* Y2 v7 g2 H( }$ L" o  a4 V1 w1 C: d+ |
//修改显示内容  U$ T9 p! G% c& t1 b. r: X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 l1 `  A. ?2 R8 \! n( a

2 L% R2 o7 J+ H' X3 t6 t/ W4 b" Y. ^1 E  P1 H- F; Z
////下面不需改变////////////
5 V: p% D5 B" a+ q9 [3 _
# l( Q' T. c9 r0 i+ |var copyspeed=marqueespeed
! R2 Q9 T2 U+ qvar pausespeed=(pauseit==0)? copyspeed: 0
9 `( U8 q7 g& G+ \. a1 jvar iedom=document.all||document.getElementById
5 I, p3 n4 B9 A# d+ K+ K- C% Mif (iedom)% \' _: t; j) a% P" d; r+ p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% S' b  |4 I5 N. U1 v, t5 ?
var actualwidth=''! R* O3 }2 [) B8 ^
var cross_marquee, ns_marquee
+ U( e) W! u1 k- G2 j* A3 s: g: m. k$ @, R. L
function populate(){
  `% T) P+ Q1 kif (iedom){
3 v% B2 D9 I0 x8 T3 Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ V/ c0 }; s8 F9 O
cross_marquee.style.left=marqueewidth+8
; V2 f: Z: ^7 Y) |/ Lcross_marquee.innerHTML=marqueecontent- c2 @& h7 H* X1 b, f( f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; L3 |9 N2 g5 y
}
1 E7 a! n* w# [; _. ]/ c$ }3 `else if (document.layers){+ @2 t- K$ H* r9 W: a9 x9 B
ns_marquee=document.ns_marquee.document.ns_marquee2
  n1 P( k4 T' r9 cns_marquee.left=marqueewidth+8& i  M+ ?5 [1 E2 T" k) w1 G
ns_marquee.document.write(marqueecontent)
; g, P2 d1 T9 \ns_marquee.document.close()
; i, `; y9 a# Y. e! _& f+ Gactualwidth=ns_marquee.document.width1 B. z% N9 U! D4 m, _
}
: _) Z$ l7 _6 Zlefttime=setInterval("scrollmarquee()",20)
: @. E. m* o( M/ {( D}8 x% ]3 U/ C2 a
window.onload=populate6 z  Q3 h* h. e3 {' J; s/ X% w7 y

" y1 [6 e/ E1 B+ Z0 @function scrollmarquee(){9 Y2 o/ s: ~8 w3 s) A
if (iedom){& }: k" S1 K2 a5 r% ~% {! q; ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# \2 n: m: G* z3 w# s+ v+ scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" O- h3 C' }  R4 F8 y# z! ^3 zelse) u) j. ^) @& K( s8 z* M9 F
cross_marquee.style.left=marqueewidth+8( Z: F/ D; `) E  b# \& f  y
3 d  m* `5 b3 L( r+ A! }  [
}
) F. x' k/ Q7 ?% jelse if (document.layers){0 G3 a* H6 z- w# ~; L
if (ns_marquee.left>(actualwidth*(-1)+8))
6 r2 z: V& _4 I# t$ cns_marquee.left-=copyspeed! ]; p" T/ U) g, g0 [6 q
else4 b# t4 W8 ?' n5 p  ?5 s
ns_marquee.left=marqueewidth+8
0 j2 e. @9 @" q0 q}+ A, q! J* I* W+ _  U* Q" z
}0 j5 k& V/ H3 j- u

+ K- z- A) }# W4 [3 p  {; lif (iedom||document.layers){) O" \% b9 I5 t3 i' O: [
with (document){2 p; ?( _3 l- M. n, v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 @& t: Z' R# X: b& m$ c
if (iedom){
) q+ ?- Z0 d) c2 t' i# hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# ?* E1 f$ B* c( S, z0 V# ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ F8 W( s0 z0 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 Q& n9 `$ G9 K% J/ t% D& ?: t
write('</div>')
" s6 L/ V* K4 R7 J: d}
# n! e1 T( l" x5 o1 m- @1 t+ O+ eelse if (document.layers){# Y4 l( E) h' P5 @% n3 L6 j' U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. Z  A  C8 H/ Z5 T$ ^1 T/ Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ C4 ?. {, P7 {8 t, Y" T- kwrite('</ilayer>'): e6 [, r, v0 N5 l& Q! Z" s
}5 ~5 I1 `- w' E& l$ ]9 X' F
document.write('</td></table>')
4 Y/ o6 O6 s6 A) k}* ^" q; y) l5 y  |4 i/ U4 j
}% [) t: d; u! M7 ~) W
</script>

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