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

|
网页之跑马灯文字特效
//修改宽度
" @* G1 l/ p0 S: t4 Lvar marqueewidth=300$ n" Z8 a9 ^3 v. o0 X- {( o
//高度
8 B4 ]& D8 q/ Z% Avar marqueeheight=252 f; W# w6 o7 ]9 V
//速度(1-10); n. J7 j% F, W
var marqueespeed=3
9 |. u! W' u; @+ b//背景颜色: Z, R' x) C5 s" ?
var marqueebgcolor="#FFFFFF"2 k6 \7 k- P' C! ^, s: \
//是否能暂停 (0=no. 1=yes)?1 |9 L( [/ Q- r. m, f7 n
var pauseit=1! ?! P$ f1 l4 E. p: Z8 Z
8 G) O G) `7 B* [6 w/ j//修改显示内容4 `! z2 z N; ]2 {5 e9 K. N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! p5 ]% q6 E6 R# g2 B9 Y! u
) d( E* E! f7 V& s: @' e- x' ]
6 t9 B6 O& n7 O/ w! `% k////下面不需改变////////////
- \) R, \8 _8 J; f7 N! A
* f- ~1 {+ R) \4 E' @: `! ^: y$ ]var copyspeed=marqueespeed
3 Y- @ z; ~& I' ~var pausespeed=(pauseit==0)? copyspeed: 0
+ x* R7 n7 T* N9 O: s/ L/ \; h6 wvar iedom=document.all||document.getElementById, }; Q8 u5 s) E& h7 j* s% d
if (iedom); t: ? S# |! m* X$ p; h' H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( K: o5 h( ?0 V" L% ^
var actualwidth=''
6 v: N- D( }0 yvar cross_marquee, ns_marquee
, g. i( A4 v3 U+ h9 d
+ A' K/ H( K' m) d D; v( Mfunction populate(){
; ?- f$ v8 N3 r! } Cif (iedom){" O! Z0 X! H; { L3 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( D0 [: p0 d% C. i' w! _6 \
cross_marquee.style.left=marqueewidth+8
. \$ C S0 w, `1 B/ ^/ Hcross_marquee.innerHTML=marqueecontent. v! L. F$ d, f1 g; s! T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! c) t- @( Q* a3 n3 p
}& j( L" D* \' h# L( E
else if (document.layers){
+ |4 y- v4 w' h- B! R& xns_marquee=document.ns_marquee.document.ns_marquee27 x! w: E ^+ ?! D
ns_marquee.left=marqueewidth+8) m7 p9 h g& I9 g l+ A* L
ns_marquee.document.write(marqueecontent)
7 W# [" x6 d. pns_marquee.document.close()
1 G7 e- F) a l0 _' m+ jactualwidth=ns_marquee.document.width
, y. D+ q$ Q5 t" F2 k}
. `% U$ C% f- S2 ilefttime=setInterval("scrollmarquee()",20)
/ h, O- ~, Q0 l' P}9 \: m6 A# k$ [; N( q$ [* c( R
window.onload=populate8 `- }) {2 {; F- ?
, ?) P" [! p5 p( ?& Gfunction scrollmarquee(){ ?, ~$ E" y1 L' P3 h. U% ]
if (iedom){
3 c" [8 {" I5 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" G1 b! `) ]( _9 Q8 a& ~6 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" e$ V$ U- {6 G/ Q. Eelse
" k, t3 F9 ?9 Z: N" \) jcross_marquee.style.left=marqueewidth+8
: x$ L t( `/ w8 q0 Q& a, D2 X( G2 N) [6 T
}0 ?& n% c" g1 L6 a9 [
else if (document.layers){
' j2 E" t6 [$ M9 [0 [1 tif (ns_marquee.left>(actualwidth*(-1)+8))1 m& T8 T$ l0 S% T8 y9 h9 M
ns_marquee.left-=copyspeed5 y7 C5 G- d3 b
else/ j# x/ i1 R! }- E
ns_marquee.left=marqueewidth+8" u; K* r9 C% w! P
}: I: V/ O4 y/ R. p
}& L) a+ K1 T6 ^4 ~# o
2 z* o. `5 C6 [- l2 m C7 F3 J
if (iedom||document.layers){
) `9 S% e1 g& y4 O& `with (document){/ }" V' F4 m, q3 J# o: J5 h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 n. O* @6 I d nif (iedom){/ S# K1 ]; U( t% ?7 |7 y: p+ Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') ^0 Y" A) ^: S9 a1 Y I* j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, C& {' |( J$ c# |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 r5 a# F* n1 o7 {5 J
write('</div>')+ u$ L9 A) V, i
}+ P0 \# ` o! ]) @: _# I
else if (document.layers){& W( p7 K5 `' x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) @+ w4 x1 [+ B6 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& f/ O; V/ j0 |% @+ q. z
write('</ilayer>')
" n& J; u0 }5 ~7 F}
$ M4 y0 Z6 w9 W$ y" zdocument.write('</td></table>')! z: K& e8 x Z6 F
}4 j/ I, N9 ^0 N1 K/ m
}
( Z5 p" r/ u3 b$ C: f</script> |
|