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

|
网页之跑马灯文字特效
//修改宽度6 `$ E4 s' S' X h/ H3 S1 R6 Q
var marqueewidth=3003 @# E2 O/ [3 w" I$ Z! K
//高度( \& a0 V4 f7 V4 Q0 l
var marqueeheight=25, X, z5 n+ q( f* P; \/ T
//速度(1-10)
+ W/ \. Z0 Z7 r% ]3 z6 m- ?var marqueespeed=3& V7 s% Z7 i1 {4 X2 g
//背景颜色
7 W. r- W# S& hvar marqueebgcolor="#FFFFFF": {9 v. r6 ^( N2 r. W. j
//是否能暂停 (0=no. 1=yes)?
% Q' Q4 U2 F- S6 Gvar pauseit=1! s' y9 T- Y7 \
! l3 _) B8 ~9 t* I2 D- p* q7 t$ C
//修改显示内容
\- _ l* h; U, ~3 p d* X" evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 _) i" ^7 K1 X
0 U0 \$ n" t( K6 p
# V* n7 g+ P; T* b C) b% d7 w
////下面不需改变////////////: d- W1 f) |. f9 r& a
7 w4 f1 O! i- v U
var copyspeed=marqueespeed& P% k7 ~1 l. N! }$ m4 C
var pausespeed=(pauseit==0)? copyspeed: 0& v) T: N `+ X$ D# q `
var iedom=document.all||document.getElementById, s- `0 ?- p( z0 r9 h9 p
if (iedom)1 j: u; x' p: `! e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) B5 T# Y% B, ^; Pvar actualwidth=''; [& r3 G/ \5 u
var cross_marquee, ns_marquee7 v! m Y! g0 s/ R) A8 E) Y" l
& n" s0 F0 W3 X8 p* Zfunction populate(){
* H# ^- k* K# J* cif (iedom){1 o5 ^: h. t% Z; _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 c2 A8 Y9 E# w* h* _' k. Scross_marquee.style.left=marqueewidth+8
* x& @* u" j3 ~" Z# ^ ?cross_marquee.innerHTML=marqueecontent
8 p8 U f1 N) h* p. l: @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 V! R+ y8 k! e3 F6 w& }1 H}! g/ h: x/ D- u* X+ ]" U5 e( s* ?7 U
else if (document.layers){
8 L% ^ T. M5 y1 k% O' b* A& A+ nns_marquee=document.ns_marquee.document.ns_marquee2
9 C* Y, T4 g/ T* I4 B" bns_marquee.left=marqueewidth+8
" H; R& w( M. Y2 Rns_marquee.document.write(marqueecontent)
: B7 d. r% M& v% s }, @. xns_marquee.document.close()
: i7 l! {5 b9 Mactualwidth=ns_marquee.document.width
+ V# p: m9 X- V6 Z, V}$ d1 R; E4 z& F9 d1 H; V5 ]( e; e
lefttime=setInterval("scrollmarquee()",20)
/ z3 Z$ Q' l: g' J* ?2 j}
+ k/ T" f" d) j4 {( Fwindow.onload=populate
( A3 q5 q( W4 I! {0 {) W+ E/ a. n- [: W; t; l
function scrollmarquee(){
! G9 V$ m% y I9 I- L6 G& {if (iedom){7 L3 p8 t. }. ?4 Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 a- f5 u/ G, ~0 i) F0 r0 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' u K% ~' ~3 u1 z' k, s& W* relse
/ e% r8 O8 I9 Z8 A6 zcross_marquee.style.left=marqueewidth+8
) j, {" i: L1 g7 Q4 c$ o
6 j2 {/ s2 O3 e: o2 K/ v}3 h9 V2 z, \; s3 _
else if (document.layers){
! c, K5 k6 `9 h$ Qif (ns_marquee.left>(actualwidth*(-1)+8))+ b+ B7 G; t; `+ W7 f- [1 n3 k6 M
ns_marquee.left-=copyspeed
) ]1 [3 ], M5 ?0 y# T8 l; ]else2 c% G; P4 U y$ n' f7 ?
ns_marquee.left=marqueewidth+8
; U) q- w! D6 A}
8 S% `' _0 X+ _}+ s T) w0 P; X, D- p+ D4 ], g
) y3 U7 W! i6 I3 l J' \* zif (iedom||document.layers){, _0 R$ K7 t. U& [0 H. h0 w
with (document){* L: T, Y5 e$ \% y B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" j ~/ F w+ ~9 @if (iedom){, O1 c) V7 Z: C& ?5 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 ~1 K, L+ X/ w) g3 e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ _) e8 V1 A; {! ~" L2 cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 `5 J7 y+ }* t7 T$ ?write('</div>')
9 c1 f# M( x$ P0 e' ^}
2 n# Z5 _0 W* @" w; Nelse if (document.layers){
8 x; b% A9 w7 j7 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 d7 v6 X* S0 M) C2 a# Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! w+ ^1 v p/ l# m5 k- {/ Fwrite('</ilayer>')" A4 I( J6 G2 }: }: e
}
Z+ @6 O0 g; f3 n. Cdocument.write('</td></table>')
& m* N9 O5 T b7 q* h' C# p}1 M; F5 a& p- d0 D: y! i8 j& ]8 V) w
}$ _" I3 B. e) M" k& `& j& P
</script> |
|