返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 r5 D5 P$ _: Q
var marqueewidth=300
( ?/ g7 e; G! }& N% a2 o//高度; y. l; k7 D- `; ?# ?& d3 ~
var marqueeheight=25
" Z, i! W6 a* `$ g5 H6 i2 m//速度(1-10)
- K% R2 N9 B# L. `: ~- z& Rvar marqueespeed=3  N) d3 f) Q8 C! b4 x6 z
//背景颜色
# }8 j* S! X) n) \6 w1 d& S$ Nvar marqueebgcolor="#FFFFFF"
+ P# W3 [* g, ~' [3 {8 l//是否能暂停 (0=no. 1=yes)?
& S5 T" F4 L) V' u0 rvar pauseit=1
1 W( @; P6 T5 G( v& \4 U( Y# g
9 F0 @! {' X. _/ g# \//修改显示内容
3 g3 p2 J9 {7 P, lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 y* N, X, U7 q1 m3 E# o+ N1 I
6 h9 t# p# \/ r, r7 {3 L

7 x# ?% Y; J5 ~& ^/ u8 u; F////下面不需改变////////////
% t& A2 u( i# u& g
. ~/ @" k1 l8 C# D# j0 Z0 bvar copyspeed=marqueespeed
1 h" \$ @4 F$ d) g4 A: D7 y" gvar pausespeed=(pauseit==0)? copyspeed: 01 F' w0 M+ [2 q( L* j' w; j, d
var iedom=document.all||document.getElementById8 c. [2 Z- q$ G+ S. R- v  p  b
if (iedom)' Z; W; r- d6 J( f9 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' [) P- w! M: y. h0 `7 ?2 M% @& Xvar actualwidth=''7 D) |( N( @, ]5 W
var cross_marquee, ns_marquee% d8 [( O( t! o0 I8 l& X7 A

+ v" T% Y0 O# U- t* v( xfunction populate(){1 I: A6 }; E/ P! h
if (iedom){
6 B  g2 l4 _# L, u! P/ Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. f0 F6 F: a5 D3 }
cross_marquee.style.left=marqueewidth+8' B7 n  D% C' Q/ b8 A  W; u
cross_marquee.innerHTML=marqueecontent8 U5 p) w: q8 W$ P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# E& O; e7 ~6 i8 b% r; c' m( y}- s- a$ S9 H! z# C! r2 H% d
else if (document.layers){
/ M: }- L/ d' I( \5 j$ S4 n1 H8 Ans_marquee=document.ns_marquee.document.ns_marquee29 Y. B9 J; Y# R( d" v
ns_marquee.left=marqueewidth+8# n$ ?# g0 s( p9 |0 l9 e
ns_marquee.document.write(marqueecontent)5 x* O6 Z( E; L0 s3 V# }
ns_marquee.document.close()
$ M6 ]' `* A. e0 `actualwidth=ns_marquee.document.width
' o% g$ B5 @/ o% _; q}
# e6 D  Z) N) j- ]+ h$ F$ E) B/ \0 Klefttime=setInterval("scrollmarquee()",20)
5 G& ?1 J3 m) N% n9 m" O7 Y  T}8 F  N* Y- Z% s/ {" R9 ~. f, M
window.onload=populate
; S! B4 n1 `1 r* @
2 a9 q5 D& E9 t/ o! ?function scrollmarquee(){
; L9 ~2 n3 C7 oif (iedom){
; e. P1 d" J4 H, w' lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 Q8 j$ h; X& j0 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  n4 R$ V1 B3 Eelse
$ q; w5 j" V  D# M5 dcross_marquee.style.left=marqueewidth+8( s( u4 c$ d9 q. _$ c: Z+ `9 R
) B$ ]6 g. r3 [! h* S$ G* J
}
0 u- s* e1 V9 V; j) Felse if (document.layers){
- L$ l* b! I/ l7 s' J- _if (ns_marquee.left>(actualwidth*(-1)+8))5 R4 I  u4 q) X% L
ns_marquee.left-=copyspeed8 x: f4 {$ W3 w) [2 t  G- y8 H
else
: C0 ^# Q. d) K  Z  x; V# k; qns_marquee.left=marqueewidth+88 z# E' w/ i$ m( f+ {( ?
}9 s$ ~+ m: a9 {8 j
}; f3 W, ^6 F* e2 T; `( ]6 u
3 E  \) d; W0 A4 `. H. Y
if (iedom||document.layers){/ ?' u+ U6 l7 N
with (document){! I( I& j1 `8 i) R( M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), G7 j! O6 g  d
if (iedom){: q$ F4 x; c. _0 `+ @8 L0 k1 r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ n* J5 k6 w$ V! o% f0 fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) W8 y# S/ D: iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' @$ v: r# d. u! k0 J! \+ N
write('</div>')6 Y# x8 R/ C( v- E
}
2 |$ ?8 Q# |  pelse if (document.layers){) L  H/ `  G5 d8 w6 G  {+ a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), ~- M! G7 \# V# ]+ X2 B+ `( r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), h, r; R! _; \+ F2 h$ d
write('</ilayer>')
4 u* M2 N2 H( m. u+ @% h. G}
1 l! p2 N0 w: @" M& f2 |" l0 qdocument.write('</td></table>'): o# E1 q' m- m4 C- d
}
. Z3 K8 K4 `3 m9 y}; Q; M& |0 r" G$ h) q5 S* O
</script>

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