返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ i8 Q  ~; A* `+ G0 W( F3 H
var marqueewidth=3001 D% `' Y% }5 M9 z2 V' t
//高度
" s! N3 |+ a6 Z; Q' _: vvar marqueeheight=25
; g2 ^1 N8 r  a. f& `//速度(1-10)
1 ]$ |0 }( W! ~) q4 a0 i6 \  ivar marqueespeed=3
; h1 w$ s' s9 O* V) e  D9 H. V//背景颜色
) M# c/ x  R+ L+ i8 Svar marqueebgcolor="#FFFFFF"1 [; J$ f/ w9 M
//是否能暂停 (0=no. 1=yes)?
, p6 u6 B* d# S/ O6 q+ q! vvar pauseit=1
$ {3 W6 M# b- I1 S; U; ?8 }6 ~& l" w  e5 Y* o8 {6 Z7 ]- _
//修改显示内容* P& s) r8 u0 q3 n: w5 v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 P5 A1 _( u! `1 g: D3 p; D) D0 p. K: W: n

* S) C: f* z7 m( s9 N# E////下面不需改变////////////
* ]5 h- {, o: Q
2 v" H, q: @: f7 ]var copyspeed=marqueespeed6 H; |/ _# l( R- g
var pausespeed=(pauseit==0)? copyspeed: 0
+ a, p& s: V$ R6 N' x9 C. h  Tvar iedom=document.all||document.getElementById
  Z* d1 a$ Q% F! V8 rif (iedom)( w6 e/ d( w- C+ [% F/ I6 Z; J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 S5 l1 P6 N3 ]# Ivar actualwidth=''8 }7 g% f# c. p& j
var cross_marquee, ns_marquee7 A9 r0 p( `0 U7 d% c
0 f5 Z. X3 a" z
function populate(){. H  f; O. r9 H! e/ u
if (iedom){9 Y. I  ~4 A  P4 l" S$ z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ U) L1 K+ C+ p3 r; ~& j8 z: O
cross_marquee.style.left=marqueewidth+8
$ R5 ^, u5 s# X# Ecross_marquee.innerHTML=marqueecontent
) g3 Q2 s5 r) \* f* Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  Z9 ?9 C, T, P+ H' a) ?}  m' N* d# R3 b# B/ v8 q# w6 i
else if (document.layers){
/ R" `, `" b9 X& }4 h; W* jns_marquee=document.ns_marquee.document.ns_marquee2! ^0 H, m# {8 P' j7 Y8 T! Y5 y
ns_marquee.left=marqueewidth+8
4 {& O6 x/ g) l% ins_marquee.document.write(marqueecontent), L% h+ R! p9 Z" N( W* P
ns_marquee.document.close()8 [! G2 K! j1 A8 ]% Q2 Y2 s
actualwidth=ns_marquee.document.width
' P2 H0 E0 S  E+ s, L}
  [$ m4 x  Z$ E/ }- Ulefttime=setInterval("scrollmarquee()",20)
- r) H9 f  _# h, D% H}6 U+ T" Q% a, ]; T
window.onload=populate/ s+ G; i6 p% Z  W
; g6 Q+ S" A1 x6 b
function scrollmarquee(){
$ B6 A6 U& X' }if (iedom){! M/ T' J1 g) W8 u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 a$ A* e8 `) z" ?" P( P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 R; n9 T9 j7 P5 E
else
7 Q: s5 [* u0 |# X* v6 Icross_marquee.style.left=marqueewidth+81 O) m7 I' s- o. P, q9 u4 ]

3 S8 }; U! I2 e6 ?& p) p5 T. g}
0 l* A; B- V9 K+ Y5 xelse if (document.layers){. Q# t2 N2 N* `2 a" x. _. P# E; ~
if (ns_marquee.left>(actualwidth*(-1)+8))
7 d$ g, |3 G1 |8 j$ L! nns_marquee.left-=copyspeed  ^& l9 W5 Z) j4 @0 g* u
else
9 r. H( y( y6 qns_marquee.left=marqueewidth+8; }9 U, |' W" p! l
}
( s9 U+ ?2 U5 c  X; N2 h8 g+ [}
7 J" W( d1 O* ~# w7 p
& s9 k& r$ f% {" B3 @4 l# Z  ?( w# B) Oif (iedom||document.layers){4 Q  @3 Z' G: g# J
with (document){
2 @1 X9 u% w6 [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 b  L, W, }6 e8 U  k: H  u
if (iedom){
- }# H$ O2 i3 T* Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 u9 R& n! ?! E1 w& dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): B  M+ T) ]7 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- O. ^8 ?" P9 e6 j7 Z; z8 h% Wwrite('</div>')1 C# P) F, @. g# t: c  d3 N
}
0 {4 [$ `$ e% i+ Oelse if (document.layers){- C: P8 \' K4 A. z$ H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: l$ p4 b0 K0 owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 t$ @  q3 g) i/ k& Q# [0 A. o
write('</ilayer>')
1 ]2 d2 p, h3 n% ~3 s5 O5 y1 m}
) l* W7 z$ Z: v+ N: qdocument.write('</td></table>')8 r$ x5 m- n: `7 L( N
}7 S* P/ b4 d$ n3 c
}
! W6 i$ A4 J" u; z</script>

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