|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
% A2 F* u1 i Hvar marqueewidth=3001 O' i+ D5 x1 n) S; k/ w
//高度
; y% i+ i G; Svar marqueeheight=259 J8 `* m u, w
//速度(1-10)2 `! f: h \+ M
var marqueespeed=3
7 y; O" A1 T0 Q, Q, |7 o//背景颜色/ V! [0 S: }1 {8 j3 r1 P- g, Y
var marqueebgcolor="#FFFFFF"
4 T$ B# J# \5 T, F4 l5 O( d& Z) }//是否能暂停 (0=no. 1=yes)?. h9 H/ y; E9 O. R2 K, q
var pauseit=1& V% K% _: j3 q
2 x: j x6 l9 _& ?! Y8 m" s
//修改显示内容) S* u) \+ v3 D/ `7 g2 C# }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ l' S% z1 u7 L! O
]" }7 ?$ ]! e! N! [3 y# w
. Q) ^: b7 M: z/ P' J% Z////下面不需改变////////////
# x; J, x' O; [" W% W4 W0 F
; `3 [7 C V3 A% Svar copyspeed=marqueespeed
7 }8 c9 Y# E! Wvar pausespeed=(pauseit==0)? copyspeed: 0
7 c5 W5 i/ t9 C- i' J( ]var iedom=document.all||document.getElementById
# i! `% q% {9 @) G+ j! v: @if (iedom)
5 k% l: e6 J- \! j: \! K @/ kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' s$ C" ?) L! bvar actualwidth=''
/ |3 \/ O/ H4 k; ^var cross_marquee, ns_marquee& j) T" r" a- J. m# g# N2 Q( F0 w
; M) O" {' \$ _6 ~; ^! Q
function populate(){
5 O+ \5 K0 A; u2 J b) |if (iedom){/ Z' T4 Y# k( D$ R g# C) M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 H# c% f# w% s/ K9 J+ qcross_marquee.style.left=marqueewidth+8
) C, L) d. M& o$ hcross_marquee.innerHTML=marqueecontent1 j: t: m9 F9 H% c$ o7 T5 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ E! _% n& H) W* t; V# [}, P3 u5 Y* H. U% J" o
else if (document.layers){& O8 ?) U# S8 |# R x
ns_marquee=document.ns_marquee.document.ns_marquee2
# F8 s* C P' X6 vns_marquee.left=marqueewidth+8
) L7 A4 O- f' N- j# e: Fns_marquee.document.write(marqueecontent): q0 O+ g, P6 N* P$ F. t8 S
ns_marquee.document.close()
0 u1 i0 {. y5 ]actualwidth=ns_marquee.document.width; V0 V7 }! L( F# C! Z3 }
}
1 C G" s* j, t; l A% Blefttime=setInterval("scrollmarquee()",20)9 Q1 g8 C: q2 Z% i/ r8 S# S: Z
}/ G& d3 }$ b0 @0 Y5 R- y
window.onload=populate6 }: F! G& ^- d+ \& X! _
$ n/ T& o& E1 t7 ^# R- }
function scrollmarquee(){. i) L D% L* N# ?3 Z; m
if (iedom){; n$ H r `( X1 j- c w; P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( w d) F; `! e6 I* R1 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 J& B' g6 `! h# velse, H/ I6 H5 P7 U$ N2 }5 j2 X
cross_marquee.style.left=marqueewidth+82 U- w: q/ y, j6 g n
& M+ D- ]. F8 C- w
}+ W$ u9 f2 Y1 `. N, H( ^4 h, }5 ?
else if (document.layers){
, u5 p' G) p# hif (ns_marquee.left>(actualwidth*(-1)+8))& f9 R6 R: N. I* e6 w( L
ns_marquee.left-=copyspeed
! G, Y* L- X8 r: f6 \1 `5 Oelse( _' _, I- _& B5 `0 ~3 G3 p4 F
ns_marquee.left=marqueewidth+8
, F! v* x" l8 R7 h6 U}5 x6 d7 {4 B$ F: X$ ^. x# S
}
/ \6 O3 M5 p$ E3 w, z; E" w" L! E B& q" V- q- \
if (iedom||document.layers){* ?7 d: Q7 @: ?# n. H2 l) ~( z8 k
with (document){' H9 h" o" J2 `! E( m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# B h# D' U2 v+ t& V. x- K
if (iedom){$ S% q, M2 J7 X$ }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! ~" f% r6 Y/ r5 L4 }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# `9 l5 \$ C0 O% qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); V: e B- O- [ o* Y: O# M4 u- A! H
write('</div>')6 E7 m+ V; c! A" K
}
% {0 m1 z { eelse if (document.layers){: M/ w: j: a, e( g0 o$ T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" B0 g; F+ C ?+ s4 l) c. jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) r3 h7 g" L7 e7 Pwrite('</ilayer>')
5 n! {6 ?/ S: n}
2 O% H4 J! Q" Bdocument.write('</td></table>')
7 F" u+ U# x+ L+ w6 l/ x}+ \4 E8 E' j4 y: l) @5 U2 i
}2 V& |% x; q5 q& J1 G/ c
</script> |
|