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

|
网页之跑马灯文字特效
//修改宽度
3 ^ I( m5 l/ C! E, Y; ~var marqueewidth=300
, H9 B P* k4 Z* @/ B//高度+ ^$ W* G( D$ V& @8 T8 s% l, r J
var marqueeheight=251 q; f& W+ L$ v( W* i9 ~
//速度(1-10), I: _& r5 Y$ m! E/ j. I
var marqueespeed=3% M* _& V+ Q! k' H. `8 n, t
//背景颜色
' [2 E: O4 S& @9 l7 G3 t, ?2 uvar marqueebgcolor="#FFFFFF"
( a/ M3 l+ U- d% D" k3 g//是否能暂停 (0=no. 1=yes)?. A) t3 g8 |) p7 q8 a
var pauseit=1
& a3 e9 h& A# W# S2 P+ V' F+ f! u$ x G
//修改显示内容
% c) p. y) F. b6 T" Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& U; @" e9 A! r" ~$ x1 @$ Q
" G, M8 p% S; e! Z' l: F7 [4 @0 ]% M# a/ \5 W8 o
////下面不需改变////////////" O0 P5 W' n, n! U* `
+ G( W8 |' p- }% H- f* k6 yvar copyspeed=marqueespeed% h" I2 G" k# ]8 n2 j
var pausespeed=(pauseit==0)? copyspeed: 0. C* p6 k/ R( F% u% H
var iedom=document.all||document.getElementById& K ?3 `" d; m6 G
if (iedom)' W' Z0 Z+ E$ I$ U5 I4 H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 Q" E# ]) |- i' b
var actualwidth=''
9 ?! ?# h: G9 @0 \4 F+ O0 c3 I- ivar cross_marquee, ns_marquee* c& ~8 t2 f- T1 S
" h. X A: c# |0 `" m6 M8 l7 a
function populate(){
% u' h D9 Y$ J& wif (iedom){
& u7 n, m( C, U$ K6 I1 Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' c7 u) Y4 e/ b: [9 l6 L
cross_marquee.style.left=marqueewidth+8/ L' o3 k8 @' B; {5 {
cross_marquee.innerHTML=marqueecontent; b: v, f2 {6 e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* d5 D0 P& {2 x6 F2 U! {$ p1 e}
% ?& u1 g; n7 s6 w7 X) `else if (document.layers){) |7 t2 j4 N" f7 N# B0 Y
ns_marquee=document.ns_marquee.document.ns_marquee2 ]3 k6 K% R+ X5 i5 x9 p
ns_marquee.left=marqueewidth+8
! b0 s o) N8 `8 o+ M+ Fns_marquee.document.write(marqueecontent)
- V) o, ]6 b6 F+ }1 `% F% Xns_marquee.document.close()
* o; z: t A( s5 U# wactualwidth=ns_marquee.document.width; K" E" V! y8 {3 z
}( H% D: o2 n1 U. |0 D( u: z' H8 m# h
lefttime=setInterval("scrollmarquee()",20)
$ T3 y* q D$ }6 [0 x, c0 x! W}3 q- ~ `* i/ u6 v
window.onload=populate
2 K9 [2 f6 ?+ B5 Z0 K4 x1 q2 l6 q+ u1 y* N2 G
function scrollmarquee(){
4 g6 ]3 s# m' @+ Q" ^( `+ C0 }8 _if (iedom){
9 ^9 X8 {4 C2 m' V: h2 d1 T0 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 ?4 d/ f# H+ e) r; b& j- i( Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 T! U- Y+ D: x7 Melse
3 j9 @- S; {3 u0 t8 g2 M. vcross_marquee.style.left=marqueewidth+8& v" Z" e. h( n( W. w: I6 y: k. D5 }
( L# @* W$ b0 V& i# N
}6 q ]; n+ L S7 }
else if (document.layers){
4 f) ^0 A( C2 o5 z2 jif (ns_marquee.left>(actualwidth*(-1)+8))
: ~+ \& E" [: gns_marquee.left-=copyspeed
! R4 {/ \( v& z' G7 Melse0 K) [/ b+ L' A3 d
ns_marquee.left=marqueewidth+8& O k; p# O( m4 V8 z$ S0 f# ~
}
+ V6 h) i$ y' T! @6 Z0 K}
( |( s9 h5 ]/ G! i( q4 _$ {2 a5 p1 {% z5 D" Q2 A* I, o( `- [
if (iedom||document.layers){0 l* c2 m- \6 S, A% w
with (document){
5 j) K4 e' p3 D9 v! X* rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& u" _. ?* o* z% r% }5 `: b6 `0 V; x' {if (iedom){' ?8 q' d3 Q2 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 d, j6 `# T4 M* {8 `! o6 y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' }$ i& F6 I+ h0 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* B1 \& o* w" o r- J6 g% Ewrite('</div>')
/ ?- h( y0 g& [}
# h! n. t$ i% [. `else if (document.layers){6 ^. k- I$ i+ G! u! _: L+ P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ P2 Y* J4 p" k& M9 Q0 U1 q, z4 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ ] h' L* @, Y# d
write('</ilayer>')
9 g1 L1 }9 z$ s0 R5 x}0 p' j3 E" _" X# W/ v3 j8 I
document.write('</td></table>')
# _" T. B0 Z$ S2 K9 W* M}
& c* H+ o& Y+ z( `; o( C}
4 W p0 q6 c& ?" ~* D# b; T</script> |
|