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

|
网页之跑马灯文字特效
//修改宽度* j; s1 Q7 a; C; m3 u; l; M! }
var marqueewidth=300
/ S# q) ^+ @5 l& y0 r//高度) p: U) d8 ]) W$ n
var marqueeheight=25. p7 P/ ?+ n2 T0 A2 u: O: l/ r
//速度(1-10)
" _) Z6 l6 H# X0 dvar marqueespeed=3
. v3 W4 U; }5 c. e( N$ X//背景颜色) k& F9 y1 v& Q7 J8 I
var marqueebgcolor="#FFFFFF"+ _- \4 n# x" c" |
//是否能暂停 (0=no. 1=yes)?" `' n$ b! B! j2 f6 h" }4 Q$ W
var pauseit=1
6 W2 t; ^$ q! b! ], e2 \
" ~# g; z9 i7 j//修改显示内容- l2 A, s( \6 m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" z W: _5 [' @
0 O8 W: B* |9 r) c) t, ?
/ M* h3 x2 j' F+ Y////下面不需改变////////////
3 V1 y1 D) t f7 g" T- F
c5 s1 ]% b0 B- v1 T! E+ Y; }3 vvar copyspeed=marqueespeed# K& {4 ?6 W- W. s6 @" E9 _
var pausespeed=(pauseit==0)? copyspeed: 0
L8 R: S9 `. [; _5 @; N: K' s( dvar iedom=document.all||document.getElementById
, o% a4 p" n9 }' b Oif (iedom)7 B, L+ ]: y- y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# h$ T: O" ]6 \5 ~( |3 Y& c q
var actualwidth=''
& m7 I8 O5 k o0 cvar cross_marquee, ns_marquee1 s% X M$ G& g$ C N
6 q$ s @, p. W
function populate(){
7 U/ Z2 E# ?; l3 {2 u4 C5 yif (iedom){
! P6 f9 s; Q8 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' F" r r, @5 n
cross_marquee.style.left=marqueewidth+8# b d, N8 g: B4 K
cross_marquee.innerHTML=marqueecontent
4 Y! G2 n9 J5 U6 w7 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& D8 m( r/ X: c) d' }/ N
}
3 j2 [$ p! z- R3 K, }else if (document.layers){
) Q& y: K, o- k* U7 ~: O8 N8 l/ mns_marquee=document.ns_marquee.document.ns_marquee2
$ M+ X7 \, N3 D9 |& l. @ns_marquee.left=marqueewidth+87 B. F" V& v6 g+ y# x; q' k! t* E
ns_marquee.document.write(marqueecontent)9 I1 W( B: B( U* U7 W, {" q
ns_marquee.document.close()
/ \+ F) l( [7 \+ r2 S' sactualwidth=ns_marquee.document.width
7 u! Z! x6 z( I L8 v( B' S}
. C! c/ h7 S. A( g/ ~; z; Elefttime=setInterval("scrollmarquee()",20) Q1 z6 @, P" m5 D7 U6 D6 A! D/ H
}1 ^8 Z- ?& k C8 g
window.onload=populate; C$ n2 f$ `1 H/ x {( \" C, F6 O+ y
) ^. A& q; U: A1 z
function scrollmarquee(){
% b5 k* b, c/ \' _; Eif (iedom){0 A1 W6 N F/ ~) U! L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, k: ^; ]8 r4 [/ M2 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 [7 O% w& D: R5 z- Celse
+ P) O, _. h* l3 |( K+ j9 P9 xcross_marquee.style.left=marqueewidth+8
# l5 _* I* F5 W# N% U6 I6 d0 t9 `! w
}
; V- @0 k# S7 H% B$ delse if (document.layers){9 O3 y: W3 L# F! i0 z
if (ns_marquee.left>(actualwidth*(-1)+8))
; K8 ]* _# H* Z# D- E( e2 f, T2 ins_marquee.left-=copyspeed
4 ~0 K/ `1 C( I, f& P1 felse0 ~6 o0 S3 s$ L+ y! Q: W5 F# I: R z
ns_marquee.left=marqueewidth+8( A& @4 g4 t! J- B2 A1 H" @$ I9 y
}; ~1 h E! G. R0 L. O4 y! A" B
}
/ b7 \, n6 z9 x/ Z; X: c9 Q o- Q; f5 X: X6 O8 A
if (iedom||document.layers){
K9 M6 d( b5 b; w! [& z: Jwith (document){
! L- l8 R, A0 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- H! N" {! _7 t
if (iedom){, \+ w( d8 b8 \: ~( t. t5 B$ c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); O! y# c' M- z3 X0 R1 M D$ t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 n" Y& L6 G1 s6 e8 D1 Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% a- a4 w# m2 b" S! t
write('</div>')
6 s$ l- W9 |1 K6 u}+ S; r# `$ _! t$ B
else if (document.layers){& T- v* y9 O6 g2 z5 H" H+ X) y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" Q# q/ r2 e, ~9 ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. b- W4 M4 Q4 }) }write('</ilayer>')
1 }8 h9 G: @$ ?% l% n( E& _}
) h5 P4 D7 q2 k" |9 ]3 H& H8 adocument.write('</td></table>')$ C7 n2 W- {; a1 c W
}
+ d7 d X$ i5 e}
9 I5 s- B4 j% X7 `2 k. K</script> |
|