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

|
网页之跑马灯文字特效
//修改宽度7 Z. q7 Q+ V0 L# C2 ~. N' H
var marqueewidth=3006 R C1 V! q3 k" U: w. @6 I0 y0 N
//高度
1 B9 `; B" F7 E' Lvar marqueeheight=25
) y7 C5 W- I' ~4 q/ C//速度(1-10)
2 j+ k* S& w3 j( n8 Yvar marqueespeed=3
9 M& {, o. c4 V. R//背景颜色+ _6 K. V6 }; T/ Q; Z( y* r4 H
var marqueebgcolor="#FFFFFF"5 a' E2 d: G% G, F2 W$ a2 }
//是否能暂停 (0=no. 1=yes)?
, L/ w! g) m# F2 A! A' E! tvar pauseit=1- t7 r4 Z- ]! X# w- g6 s
6 |* X, g: v# q7 z- C//修改显示内容
, o" P7 \% Z, r: i' gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* ^! N" |. I' G/ W
E% g6 E' T0 j" V; z. z7 {* a
% n# H4 z) l5 F1 H1 n' t9 E- L////下面不需改变////////////2 p v: m) n7 K& r: y5 n
0 v9 Z( S9 M0 avar copyspeed=marqueespeed0 v+ a: B( j. P7 N2 J
var pausespeed=(pauseit==0)? copyspeed: 0
v* e% q# \# Q7 ]4 Bvar iedom=document.all||document.getElementById
3 V, l5 T0 @6 B/ Uif (iedom)3 m4 W* E, d- \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! g ^) b$ \ M, ~var actualwidth=''
7 j$ B: ]3 E |% Q2 X% q6 lvar cross_marquee, ns_marquee# `9 z- B- ?9 u& b7 Q
. a# @8 |& h# u: f( Q' nfunction populate(){
0 f& g. o0 }& h: nif (iedom){* M. M6 A6 I ^+ o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% `7 g9 w% d5 ]( |
cross_marquee.style.left=marqueewidth+8
; j- t; E6 F* l4 C5 s# h: tcross_marquee.innerHTML=marqueecontent+ K$ k: Q6 Y# _$ v M( m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, e& T T+ x5 ?7 A6 X% }3 g. g9 I# N3 Y
}
* J2 ?. M4 L( `) \' ?1 Pelse if (document.layers){* y# Y2 {$ p. ]7 Q3 M; H
ns_marquee=document.ns_marquee.document.ns_marquee2
6 ?( \; G! Q# fns_marquee.left=marqueewidth+8, r8 e7 C! _" G1 Q6 o
ns_marquee.document.write(marqueecontent)
7 K" P) K/ n* K$ ~ns_marquee.document.close()
2 ?/ `6 A& U! Z eactualwidth=ns_marquee.document.width8 o% U m* k$ q9 C
}, j7 G: c. ]* G e1 G- h/ |2 U( `
lefttime=setInterval("scrollmarquee()",20); \$ w! l* m+ Z
}
6 }! K" m7 k; Mwindow.onload=populate' i1 q) y% |% S
; r- F2 i, D; G# [function scrollmarquee(){, @/ n k" T% ?! Q* p
if (iedom){0 [! q" o. ^. |, |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" |5 X! y D. H5 ?. G. g- Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 [( p$ b. X& T8 S3 u0 ?else2 T5 {( {: Z+ ?$ a. g# j+ H7 y
cross_marquee.style.left=marqueewidth+8) W( k" O5 t( D6 c1 o1 b: G, Q, @1 ]
" P0 c5 [2 g9 ~6 G- H}3 A( ~# i9 u4 z
else if (document.layers){9 h4 q/ g& {. e2 \! p/ N
if (ns_marquee.left>(actualwidth*(-1)+8))& s; _3 T. W& B7 |
ns_marquee.left-=copyspeed- ^1 L* d3 w! H/ f. i
else) Z9 g! d( C5 W8 J
ns_marquee.left=marqueewidth+8
: [( Z! N+ E: D' t3 a2 p& s m# _}: s, S' x H3 v+ {, [" ~
}
, [* o4 q9 s# ]( ? B
1 I% s% n2 i: H+ E9 ]6 C1 v( Q* gif (iedom||document.layers){9 S. G# `2 D6 {5 S6 ?: Y4 X
with (document){) E Y, B, h. z9 C( E: q4 U# S7 b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& d1 R5 E/ a% C5 r, @$ @! kif (iedom){: ~8 B9 a* w" @" g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 C: |7 e# y% e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' R' B6 O. b8 e5 Z8 N: G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% ]% S9 n9 `( {# x$ d, Ywrite('</div>')0 b# T% Z8 K( T2 U: c/ w( ~; d5 D
}
; e' I2 r7 v; e: c1 C+ C; [/ helse if (document.layers){& R. w# l* o1 T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 f$ O" u0 ~ M2 d+ S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- _' V% m K6 j5 L! Y% M
write('</ilayer>')6 P% @/ B1 s5 A& }+ {8 w: s
}; O2 c; b8 j9 h+ B! F- S
document.write('</td></table>')
; m6 ]; o* u# \: X% _; K8 w" g}2 m: e% N3 }* {2 t" T6 j! ?1 [
}0 k, O) `; }) ]9 }
</script> |
|