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

|
网页之跑马灯文字特效
//修改宽度: m0 u d9 }% E) L( j/ ?
var marqueewidth=300' m- i# x4 Y! f' m6 ~* v3 Z
//高度" g |5 q0 G0 k6 _3 G) z1 A
var marqueeheight=25
8 z7 w9 i+ y/ P% `# f7 F//速度(1-10)
4 j4 I$ i/ O. W9 {- o+ bvar marqueespeed=3
2 o( }! R2 ]/ E. O+ @9 U2 V. p//背景颜色( \' R. h5 Q% b
var marqueebgcolor="#FFFFFF"
7 G3 z$ B. V2 o. K//是否能暂停 (0=no. 1=yes)?
! M5 v8 |9 |) p/ ^var pauseit=1
1 x$ p9 {6 h/ B1 M3 _8 z4 X5 r. O d
//修改显示内容6 v5 Z) R5 e) Q( |8 [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, y* K5 c9 }6 s" J& d6 b* f7 ~# \; b/ \& [" w- n" n0 ?
9 b& X" B& t2 ]. F/ n
////下面不需改变////////////& T' f( B! B& V$ w% V
& p! Y% d% \( y& K: lvar copyspeed=marqueespeed
9 m2 t1 j; b+ X" rvar pausespeed=(pauseit==0)? copyspeed: 0
* Q; R% v0 L4 i: v& D6 x; z7 Nvar iedom=document.all||document.getElementById
' Q+ |( w) d% c- `if (iedom)8 u8 Q& ?$ `! E x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) A9 C& Q2 ~" o1 ovar actualwidth=''0 o' R) n* T0 }1 g3 h( Q
var cross_marquee, ns_marquee1 n- ]+ s4 D% g7 C0 S' h9 x
) G2 w m- F- v2 z# v" P$ @
function populate(){
' L G8 q5 m5 ]if (iedom){2 f. Z5 p0 V7 M8 m1 L: Z7 ]# ? a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 r" Z/ g0 D, U5 a
cross_marquee.style.left=marqueewidth+8
! a) { x! P4 m# \( Ncross_marquee.innerHTML=marqueecontent
& w2 w$ m. T" c H7 mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 p& A3 F5 n+ y) z}
% u2 d8 _/ R) [( C( C: D- ^else if (document.layers){ i) ?8 q2 s- E0 R
ns_marquee=document.ns_marquee.document.ns_marquee2* P6 W3 y, h: e
ns_marquee.left=marqueewidth+8
( t. s% t/ M6 A* Mns_marquee.document.write(marqueecontent)
/ k+ y G0 i' o8 ens_marquee.document.close()
' _; F3 a, t; Z9 b- K0 `( R5 jactualwidth=ns_marquee.document.width
/ X Z& ]. N+ H+ ~) W0 ]}
6 D! U" ?! d- H2 J5 C; |0 Llefttime=setInterval("scrollmarquee()",20)# `1 k7 G" c. p& P0 n k
}
3 J# U( f! H% \0 _. ?, R, M0 hwindow.onload=populate
/ z3 L2 a# u) N% l; ?3 `$ \" Y8 g0 X8 O2 Y2 x4 O# L: p
function scrollmarquee(){
% I7 N* V+ }2 T3 @9 Z: \! Kif (iedom){- C/ @8 u; _- n! f( y0 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 n s. K$ @( F2 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( `. M- B/ F- m- selse
9 ]+ `, n7 @7 h1 \8 l/ t* C' d2 }cross_marquee.style.left=marqueewidth+8
: U8 b; s3 w. @* @ T2 p! l) @: u% {7 R" `/ m1 w! H% L
}
2 i" F, U3 O$ E" aelse if (document.layers){
( q2 A. @- v' g8 r5 Q: Iif (ns_marquee.left>(actualwidth*(-1)+8))
( [7 o% Q3 j& M& jns_marquee.left-=copyspeed
; ?9 U+ ?, o4 g- h* t5 F+ Welse
7 T3 P P5 y; B) Bns_marquee.left=marqueewidth+8
8 J, M! Y$ D! t2 K; \# w}
4 _4 d% Z0 G& E+ @}5 Y- D0 v. o$ _, Z9 B* w2 q \, i
( f% d" q6 z" b! t5 d9 O. x
if (iedom||document.layers){
: ]3 P" F1 e# Fwith (document){
% Z- t w5 x4 W3 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" ^: d% D% z, z5 t$ J& t& i8 M( E
if (iedom){
9 j9 `, g4 X, P$ T) E0 ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 f7 ]1 T4 A* R) W B( i. Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; J8 c' m: b) [# a, Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ s! f1 ^+ Y8 V/ g- ?
write('</div>')
" _/ d8 [+ w8 v+ ~}
4 i- E: P7 s1 f# yelse if (document.layers){4 {3 _$ }( x4 K( \6 {! e; G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! T7 d9 I+ h0 O( w: I8 Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' Y! ?# ]% b0 c) i) R- G/ Z2 Jwrite('</ilayer>')* M3 q. ~0 D- }0 x
}7 C) N/ F/ F' t! ^+ M. f6 p6 E
document.write('</td></table>')
7 @; E6 `$ n! ]" I. N/ A3 v8 S5 d}
( q% Z D5 q* u2 ~) ?" ~}+ M/ C0 X6 u* H) n
</script> |
|