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

|
网页之跑马灯文字特效
//修改宽度& n% B# G. a1 Y
var marqueewidth=300
x; V. W, B, y) [//高度
9 j( P5 c' V, Q% y# d3 F3 k' yvar marqueeheight=25
* V! W3 Q7 Z1 p+ w//速度(1-10)
) A% c# I# [2 u+ ~7 h3 kvar marqueespeed=3: d, ~; A. m8 w( ~. n* X/ p# H6 i
//背景颜色
) Y" T5 [5 g1 n& z/ B( evar marqueebgcolor="#FFFFFF"
' [4 K+ o' c7 y) y4 X//是否能暂停 (0=no. 1=yes)?' [* ^+ T4 ~3 e: f( G
var pauseit=1
, I/ X0 V, @$ q% z, p( Y5 L. E0 k1 }& Z4 M7 ]
//修改显示内容" X) s9 ?4 \, _7 c6 c P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': w" L8 P9 H$ p8 ~; z# G
; S% H6 L6 |- k
! o+ t+ }- m' e& o////下面不需改变////////////: g( F- }0 a2 U8 w5 k
4 G% H' V6 x) C g
var copyspeed=marqueespeed
- B4 e( s1 C! q+ s3 g) ivar pausespeed=(pauseit==0)? copyspeed: 0
8 p/ w! N/ d* S6 z+ uvar iedom=document.all||document.getElementById+ h" Y4 g, s! e$ U
if (iedom)
1 p, q0 C" y& g# C8 g- idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). q' F) \* [& I. @5 s! }) \, N& g$ p7 ^
var actualwidth=''2 ]) \& V6 t. E. t4 R. g$ p; b' f
var cross_marquee, ns_marquee
8 F) ?" x! U- K {( B
( e, b9 a$ p5 l2 ~5 Tfunction populate(){8 D/ K7 m% K4 u. b6 K' W
if (iedom){9 {- K% A3 y/ b# C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ v6 }& K% b$ Q! x( G
cross_marquee.style.left=marqueewidth+82 R) t# Q) s: I c, v
cross_marquee.innerHTML=marqueecontent
4 O9 `! D3 r% F' r2 jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 q* `7 p9 R" g
}
2 ~% x- O) v; u0 Qelse if (document.layers){ G1 A$ y2 }5 E8 |
ns_marquee=document.ns_marquee.document.ns_marquee2
* S% X8 @' M0 Wns_marquee.left=marqueewidth+8) w3 P9 x7 R7 s+ ~
ns_marquee.document.write(marqueecontent)' ~. u! |) _4 M( t) i) F* J
ns_marquee.document.close()7 P9 c% G- U' g/ {* Y+ q( ^
actualwidth=ns_marquee.document.width/ T4 s- I9 ^- |6 R2 t5 H& m* F
}( B I) T0 z# m- P' {! J( \' O- b
lefttime=setInterval("scrollmarquee()",20)3 c4 x9 k* i* @ w, S% s& |% S( @3 e
}
+ }1 p0 `" v& S1 C) qwindow.onload=populate* e- ?0 D9 L) l6 n) O9 }
# g @1 m' b; {+ ?2 {0 ?/ V) d/ ]
function scrollmarquee(){$ ^5 \) n9 L$ e% O; R
if (iedom){
) J( [# w7 Y: M, W# b# _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) g) i& L) j9 r5 ~, W9 [# `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 K* Z# ], ? n" belse
5 y4 a! o) g$ dcross_marquee.style.left=marqueewidth+8
/ V& C( G$ ^7 I9 ?- [7 F% W7 Z1 v! `) Y& ~7 [9 Y* D+ Z4 r
}( \4 d8 ]. T x; ]2 @, |; f/ {* @
else if (document.layers){; z' l- t5 j7 w4 D! ?# I( W: e
if (ns_marquee.left>(actualwidth*(-1)+8)), m; {: P4 Q& M+ P# p4 P" T1 `4 `
ns_marquee.left-=copyspeed
# z/ I: c- H$ x2 q% D6 telse+ R: Y Z7 g% v: ~5 Z
ns_marquee.left=marqueewidth+8
7 P3 ?* K) V1 B; p5 N}8 e- S( t9 o4 F& p
}" v2 e; `& z t; U6 x8 m' @
8 u. m/ y; l1 P' Q$ P9 Jif (iedom||document.layers){
- m7 O; ^2 o' K6 Vwith (document){
: I2 `7 w1 W8 [8 j8 G, Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ U1 `* ^. p6 B u3 o' ^if (iedom){
: b- r' d' J; Q% H- B! Q) S# L; @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& g" l* d0 \1 p/ B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) }+ m+ c* E" s3 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 {! h9 [) }/ a T
write('</div>')0 \# e) q, N9 j6 T
}
`# }" z. N; w& O7 F0 |; t5 Xelse if (document.layers){* j; G# V& ^, U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 ~; o- w* a+ P- B4 R0 ^6 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: L" `; K- P7 L) f! P8 g& O! xwrite('</ilayer>')
" K5 q& Z6 C% _5 S4 J; T}* o. b. l7 f0 D4 F8 v& C
document.write('</td></table>')
6 j3 H) |& R6 M' D9 u3 t' r}
! l2 J1 ]% d% g, H4 m6 y% E6 H3 c; x, Q} S$ J: O6 [7 u; h
</script> |
|