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

|
网页之跑马灯文字特效
//修改宽度# p1 o% A( ^- x
var marqueewidth=300
( a8 e5 Z% J. m$ ]3 E//高度
, C, l7 K* m& ]+ N6 P! mvar marqueeheight=25
' o8 u, U* }3 X" O$ n; i6 B//速度(1-10); b3 g7 I; s6 Z# O! U& ?4 a9 D* F
var marqueespeed=37 |9 {* s3 p2 ?4 j7 `" N9 N
//背景颜色% w {! X6 d7 V( m2 h6 \
var marqueebgcolor="#FFFFFF"; O u( R- A& t: K: @
//是否能暂停 (0=no. 1=yes)?
8 [7 u7 `+ l2 F3 B, jvar pauseit=1; C9 X1 v+ t% A4 r, S3 {
i: @) s, i& f! J//修改显示内容
) ~9 _$ F1 }, r$ `" Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" S: A/ M0 U; s6 C/ Q a
# R$ T! u% Z2 Q( M
4 u' q+ Z. i( g. H' M
////下面不需改变////////////
; R. R9 h- P3 h) N
. C4 O( _+ H4 c4 C4 V% H1 Qvar copyspeed=marqueespeed
( B2 A: P& b. D# W) i8 }* J7 @var pausespeed=(pauseit==0)? copyspeed: 0
/ H w6 w7 d$ t( [- p# ]var iedom=document.all||document.getElementById- o M& c$ C' F
if (iedom)
, V0 h P7 V2 d3 O/ i1 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- ~0 W( Z- b) ?+ m$ i. J
var actualwidth='' b, f, A8 q4 I" R, u# }
var cross_marquee, ns_marquee
, y# g$ B5 O7 d; |8 E; Y( {
! f7 p! X# M* ?6 ~: T/ I1 Yfunction populate(){
# k! q- N, U6 x6 h9 Bif (iedom){
' E5 Z( W( x) F/ {/ ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 w" w; C% c- e- fcross_marquee.style.left=marqueewidth+8
! g! \6 X+ l9 P% Ccross_marquee.innerHTML=marqueecontent5 F# j, S, |3 E+ ]( P+ J, ~, B' D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth e( k+ T; ~9 N, a; d( _9 u) Z
}
2 w# E) B0 P1 y6 {else if (document.layers){* C& R. d; E) ?% _/ L g3 I
ns_marquee=document.ns_marquee.document.ns_marquee2 D& F6 c) J% m. G
ns_marquee.left=marqueewidth+8" i: k8 ?4 v/ s3 E. Y! m+ l. n) Z
ns_marquee.document.write(marqueecontent)7 x; l( f$ N/ Z7 {& I" J
ns_marquee.document.close()' C5 U' w3 q0 O% ~' G Y) U" t
actualwidth=ns_marquee.document.width
/ q% \6 S% y |1 @ v9 i& j}
3 Y7 y- u/ p1 Blefttime=setInterval("scrollmarquee()",20)
, ?% ^! E) t5 p}
' `# T3 O# B+ s; @4 P- Vwindow.onload=populate. U% G- M# j/ ^
0 T' D1 O8 |- ?+ lfunction scrollmarquee(){# V" C% o T) u; z3 v8 G3 s
if (iedom){
7 t! B; ]* `8 z2 G% \5 O# l" g# u1 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% P) e7 r7 |2 P. D; ?3 X- m6 }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) g8 \& L2 @" z$ s# _8 N
else6 A) t* x% M: r4 v- D/ v* N
cross_marquee.style.left=marqueewidth+8
7 I) @! c5 x5 t% R- q3 {( G7 N0 G/ m% G" @3 {
}: {; e. N$ f) M; o% P8 L# o$ C: h
else if (document.layers){- ~+ ?9 D/ ~$ ~5 ~
if (ns_marquee.left>(actualwidth*(-1)+8))
" D/ x1 S( v- q$ B0 ~ns_marquee.left-=copyspeed
& X5 ]/ j1 G2 Y- `4 n1 r& jelse* w) B' h/ h* R- E& Y. u+ z% H
ns_marquee.left=marqueewidth+8
7 L( r# `- u. N8 E}3 v7 g, f" `- u5 C" J
}
- |' o1 Y3 i% l6 k3 F1 }) j0 i& I9 b! P2 Q, M( M
if (iedom||document.layers){
) C6 H) q' L$ p0 ~. zwith (document){5 J& _; y: D: q2 _ z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 {# @8 g' }0 F, [. r2 i- R7 G( g
if (iedom){
4 I/ p2 t1 h3 M0 ] ^7 L- Z# w: ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 \; j3 a7 o" p* r/ a' f$ R6 o4 P( G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' n3 K, ?! E3 J( `# n+ T) O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% F6 m0 z8 s M" {9 m T z6 k4 cwrite('</div>')" t; H- {5 f4 m1 ^* B$ y
}
! S; r% _3 t3 z0 J9 R2 f$ i3 relse if (document.layers){
9 Z: ^( ]3 m# |: C- d1 g1 wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& Z' u* I( _8 ? t( x- \3 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 p4 f, F( r, G* E, c+ Vwrite('</ilayer>')( r3 X$ G" W; J( N: R. S
}
4 b6 h2 g5 {5 t1 c- ~( Hdocument.write('</td></table>')8 g% q/ e( [, T U" w7 @) w3 G' k8 F
}
" Q& T$ V3 m- [; K5 ?" P, |}" n8 V$ v4 k [: |$ U
</script> |
|