返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 `2 T2 w5 V8 I4 _$ Q8 rvar marqueewidth=300
+ a; s9 a! a3 w* x5 F$ T7 U4 P//高度* k4 e: `( E# N4 ]7 {
var marqueeheight=25
8 l! K' v! ^4 |/ k  D& Y4 V- z//速度(1-10)
, Z  s, d) p# h( ~5 \3 ~4 ]2 Bvar marqueespeed=3
: I) z9 Z. t: P- e" ]1 j0 `! d//背景颜色  W# G/ Z4 V& a) l0 h
var marqueebgcolor="#FFFFFF"
+ l! Z  R9 S! [0 g//是否能暂停 (0=no. 1=yes)?
8 N& a$ C: l  ~: V* Hvar pauseit=1
% @* S$ P/ Q) D. s- L; b* x& C4 r6 ]% |. k5 C# J& _! w
//修改显示内容
+ j# k7 j0 Q$ i  B/ Y$ Y0 `0 X' Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* ~7 ~* W' R% D, Z& C" }' k1 o7 G" e( j: t. J3 V& y

( v- z2 s# `0 B/ j////下面不需改变////////////
7 ~# |9 d' d9 @% |5 K- l$ e5 W; v  d9 G. c
var copyspeed=marqueespeed4 v  C, i* _; ?2 x7 K6 B; t5 s
var pausespeed=(pauseit==0)? copyspeed: 0
* g- e% b$ V: S# X9 {. Dvar iedom=document.all||document.getElementById
; k8 f' a4 c) j( A7 T  S7 U2 Lif (iedom)) K* `) {7 m1 m& y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) c; u/ A" h/ \2 l( K4 o! evar actualwidth=''9 j' y0 w% R1 K: N) i
var cross_marquee, ns_marquee, e/ J. D) E( p5 O0 E* a
* ]* g3 ^; E4 S
function populate(){
) K; O+ R  f9 @- }; J2 z/ \1 mif (iedom){6 F  ~9 E- G/ O5 h: {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! p; l* g0 h' H8 N
cross_marquee.style.left=marqueewidth+8. `4 P5 k6 Y8 m6 s, E( V/ J
cross_marquee.innerHTML=marqueecontent; g+ P7 D2 k6 [6 o0 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; a% w& v( v, a
}7 n$ Y! d3 N7 N6 R; ~$ D
else if (document.layers){4 I; w! ^8 t. A6 f
ns_marquee=document.ns_marquee.document.ns_marquee2
# F; A: Z' M  M7 r+ \" _ns_marquee.left=marqueewidth+8
$ t- o! F4 [% D/ e1 s2 Ins_marquee.document.write(marqueecontent)
9 e/ y. [, W1 [9 _+ _+ u3 ~% Ens_marquee.document.close(): Z/ T1 S7 r( W% D7 M$ j" d9 R
actualwidth=ns_marquee.document.width; |4 L' Q% Z8 r# i6 x
}
% u$ U. G7 M8 ~8 C5 k* [2 Dlefttime=setInterval("scrollmarquee()",20)0 R; G( u. F$ j( g8 j* X6 a, z+ r5 ]
}
# U. V: b0 x% F; Awindow.onload=populate
7 ]6 N' x/ u- S0 \* h/ r) u% C( Y
, G& G( j0 H; b$ ~5 [function scrollmarquee(){
6 K% j+ g/ I! {! m, n, ~5 ?if (iedom){0 ?% }. }3 v) ~3 n, K4 d/ ^) E2 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 i) F. g0 \- @6 d3 i- `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) N: H! c5 Y6 s2 x+ B
else6 W5 Y/ R2 Q' S) G
cross_marquee.style.left=marqueewidth+8
- o/ ?/ ^" _- b! U; M+ P( ]+ a8 L. B) m& o# w$ ~7 I
}
: q* ]% w# F/ l0 Kelse if (document.layers){
7 T, g/ j5 h2 Kif (ns_marquee.left>(actualwidth*(-1)+8)); V  J) b& v% I; s, c0 I/ g
ns_marquee.left-=copyspeed5 I, s$ M  f! d7 r8 g$ M, U
else" v2 u) {) G+ A* w" j: c
ns_marquee.left=marqueewidth+8, Y- v6 [, `) Z/ r! t5 o0 o$ g1 l
}: i- \5 N2 g0 y
}0 D0 Z8 }8 d6 }3 \; X, C: L! \( v

/ a" V: i- }. o/ ]& oif (iedom||document.layers){1 W# {0 d; p0 z3 }) p3 R% L3 ?& a0 W
with (document){: i- q: o/ ~) X/ s2 {$ {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! b7 p+ b: u, b, t; B2 ^/ Tif (iedom){
2 Y  S3 ]" n  Z2 H1 ^3 }( gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 L9 U: @6 u# \5 x- J8 I: i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ q) q( [- n8 [/ a/ u! r6 Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 }1 j% [0 b9 |* Rwrite('</div>')
6 P. ~/ I3 Q& [2 S) o}2 b7 U$ r, {" v% n$ s& {& `
else if (document.layers){
0 S% i  b/ T; E9 k2 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 e- J: w/ v4 @6 P9 B9 jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 ?' W. D$ b' g8 H0 g* kwrite('</ilayer>')
( ^' G0 R+ e9 _$ p) O}1 [- N+ A1 ^, ~
document.write('</td></table>')
" E" G. t+ O4 o}
/ n; o0 m; ~; R7 T% ]$ j3 ~7 l}! I  R; Y3 l! t5 L! F- y$ ?$ F$ B
</script>

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