返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: M% W- B" x, N% {: D9 l& v$ A5 C/ yvar marqueewidth=300( ?0 k/ s$ n3 q/ p! H
//高度
! ^) o. D2 v0 f: u1 Nvar marqueeheight=25
1 D  B* [5 Y- r" V* z5 j4 b//速度(1-10)8 a: q5 X; Q$ U& |: K
var marqueespeed=3$ X& w; S9 x0 a7 L
//背景颜色
( F3 c7 J1 i/ P7 a: B4 Tvar marqueebgcolor="#FFFFFF"
! E1 Y1 I$ \! O4 \* C7 k# R//是否能暂停 (0=no. 1=yes)?
6 ^3 V. B5 z9 i, M: Nvar pauseit=11 b9 |. Q( T5 B
* ^6 W% W; s- K# k) k. P* |! e
//修改显示内容
  c  @0 [" p1 @. H8 L, [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ T2 w0 i+ I' Z' Q
- Y4 _. G! l* I& K% o6 r
8 [( R0 p3 l( W, R( ^, p* Z: L; M
////下面不需改变////////////
! s: \/ v0 L+ b1 p
; A* o+ x. L. R: S/ Z! dvar copyspeed=marqueespeed
$ v7 L/ T7 w' S+ r) U/ \/ }1 r4 Lvar pausespeed=(pauseit==0)? copyspeed: 07 T; V$ C. |4 \8 F) {. C
var iedom=document.all||document.getElementById( Z' q& {( T5 n, }- _1 ^
if (iedom)( j7 S7 |3 W+ w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ D  ?3 e2 r; K) o0 q% ^2 Hvar actualwidth=''
7 q' W) v3 A- ?) }( W, F; hvar cross_marquee, ns_marquee
5 C% s0 J4 e4 J9 {; ~' C$ L
# k* b1 d3 x& x6 [6 @3 \function populate(){
( M! [7 q# m: y( Z9 ^; o) |  y+ uif (iedom){
( Y% N$ r6 ^" ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% c' P- C7 ~5 K( Z3 x
cross_marquee.style.left=marqueewidth+80 J7 V( M% F) l% w; w' U
cross_marquee.innerHTML=marqueecontent5 d. d6 n5 s7 [* ?& ^1 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 m. u& `, z& i5 H}1 T: h, n% B  R9 K6 [0 d* ~
else if (document.layers){
$ C( ?( H. p8 s9 [' zns_marquee=document.ns_marquee.document.ns_marquee25 I) R" @& P& u
ns_marquee.left=marqueewidth+8; ?6 G1 d' d% A+ q
ns_marquee.document.write(marqueecontent)
2 y7 u4 M* ]0 K5 i& z2 V$ p8 Hns_marquee.document.close()
( I& ]- j, ]. G& Uactualwidth=ns_marquee.document.width; U) A# i) ~5 z/ D, f5 v8 \) P
}( R9 z2 G7 Y- x! S- D1 a
lefttime=setInterval("scrollmarquee()",20)8 `8 S8 {/ b* a
}, l, L+ ]/ [2 T7 N
window.onload=populate
& }7 Y* a; Q) N4 ~
' M$ X% p2 s0 t4 ?) n7 x* A. O4 Ifunction scrollmarquee(){( b. }& d5 ^5 ?* n3 Z/ Y; r
if (iedom){0 V7 w9 `: L* u3 I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' E$ g! ?# `; ?2 C! B% ?6 e3 across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& B8 Z) c! K: s
else* n1 k  ]) q! o7 E
cross_marquee.style.left=marqueewidth+8
/ u9 Z0 ^1 p& I4 e: Q
/ a2 z8 J1 `8 f7 `}
$ H6 y. S0 i# P: \else if (document.layers){
" y, Z+ B! U( |if (ns_marquee.left>(actualwidth*(-1)+8)), \* ^/ v* Q; [4 r5 |  M& V
ns_marquee.left-=copyspeed
& l4 l7 R/ y( q. X+ h% g+ h# ?0 Uelse: y; \! l4 `8 D
ns_marquee.left=marqueewidth+8
! ]0 C6 r* t( b}
+ W! y7 C8 B9 @3 C5 J  e4 c; \  q}  ?# \9 |& [, h6 [; O; ^8 t; O8 P

& n, G+ s: p% S/ j5 bif (iedom||document.layers){
  n# S3 d; o. g. a6 ?% }with (document){
+ H9 V3 J$ [3 S$ N0 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 s& Z2 h! {& V$ M" }% Sif (iedom){+ v0 H% C7 |0 e2 m% ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* Y5 f+ k( q/ t" x5 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 h4 u  Z, C) y, U/ A6 C2 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ [  P- d9 S0 f/ ?/ r8 p3 Ewrite('</div>')
0 D! z; B9 |5 _. e' N5 N+ a& P}
! F1 M6 R; U; |else if (document.layers){
! o; S1 a, M  I3 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" W; M8 h% b8 Z. x0 d7 K- y, D! A: {6 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 y' {$ T; [3 p5 P* D6 }write('</ilayer>')6 {8 k5 O* c5 c1 `
}8 V2 _' B2 ^; y
document.write('</td></table>'); q  b2 o! o. `) N. g' t, e3 g
}8 K# L  b' f: Y4 F2 Q
}
2 h% v- ~1 c" `  i/ Q1 `. P3 ~</script>

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