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

|
网页之跑马灯文字特效
//修改宽度
' j& ]" F, b- m1 z0 D4 P1 fvar marqueewidth=300; l' K2 `2 i" ~0 r* K7 H) n" y
//高度% M: M6 @8 ~; ~7 M F
var marqueeheight=25
; f! p! B, a8 S8 ]/ E' H//速度(1-10)
G- ?; W* q5 e8 Hvar marqueespeed=3
7 }) D0 |' [# Q$ D9 H4 m7 |//背景颜色
) b' _7 z; h5 p+ {var marqueebgcolor="#FFFFFF"
+ @& d6 y! o4 K" P8 N7 ^9 Y/ d//是否能暂停 (0=no. 1=yes)?
. X8 }" _/ ^8 W5 Fvar pauseit=17 H! Z8 S: E* R( |; g' d
$ g0 o8 N6 E# T7 r" X. j$ D//修改显示内容3 {2 }. D% y! m4 s/ [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& a8 X9 A8 a3 H9 d+ ^& T9 J+ R3 [" U# k0 E9 c1 {
/ v5 T3 e/ _1 w! z; B& j j
////下面不需改变////////////
( j# z: Y$ ?7 W9 c1 ~& a1 L; Q; M8 P; E+ t: P0 G
var copyspeed=marqueespeed
" r3 ^/ W5 ]3 l" y8 x/ ^& hvar pausespeed=(pauseit==0)? copyspeed: 0
9 M/ r3 n* z n* k qvar iedom=document.all||document.getElementById& y) j* S) d. h2 |7 c; W
if (iedom)8 o, |, j( C: [8 D. @/ j7 Z2 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 n) {5 H0 e" J" I" bvar actualwidth=''0 b6 Q" ?/ F( y+ s
var cross_marquee, ns_marquee5 i. Z( m9 n8 x! Z8 _2 O8 @: k
9 {7 e- W" b" p4 Q+ m
function populate(){
: S) c2 J; P U" Eif (iedom){( g: l) o8 H) M+ c0 I. G) w1 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 g5 D" B( D+ R+ G9 B- x5 rcross_marquee.style.left=marqueewidth+8
9 Z3 c5 G' K' s. ocross_marquee.innerHTML=marqueecontent
- a* _# a+ O5 S( r7 B3 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) }) p) X- B# f) P}. o; b( _% a( |- }6 z1 D
else if (document.layers){
7 ]" M7 S5 p# m# f0 [$ |9 \ns_marquee=document.ns_marquee.document.ns_marquee2# d3 c2 Z& V2 |! k3 w
ns_marquee.left=marqueewidth+8
q. M2 n% _5 R. V) |; Z( w% ons_marquee.document.write(marqueecontent)! z1 W6 q, D( C5 t2 g
ns_marquee.document.close()* u" Z, j; J [; p. N: C, e, ?
actualwidth=ns_marquee.document.width" M B6 X9 v9 D. ?' v
}
* M" F/ P, ]8 v6 m! {3 V" klefttime=setInterval("scrollmarquee()",20)5 r: c6 M% L# g' c5 |3 Q
}$ n" _# h8 i1 b! N& l4 o' |! Q, q
window.onload=populate
0 g) ]8 Z; X9 f" F. ^9 t
, N) x+ {1 l- @( Q, w; C! Zfunction scrollmarquee(){
7 p9 P$ Y, _% ]) Cif (iedom){! P; d4 L% n2 o3 ]% b& H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 [ p9 Z! @/ ?* t( k4 `. a; O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; \/ l* U. J2 B$ I8 j: L1 g
else8 \) F6 p0 }' w3 I
cross_marquee.style.left=marqueewidth+8/ W" ^! b0 t0 o6 n5 P& m
" o: h& P& }0 N+ W, `: }
}
0 ], B% L1 y& y# K6 Yelse if (document.layers){
/ }0 K7 @$ \2 xif (ns_marquee.left>(actualwidth*(-1)+8))1 v9 v! z6 X4 e1 Q& D# v" g
ns_marquee.left-=copyspeed# n# B' P* G$ I: E
else, a5 `) X! R5 L" ^1 J3 p! X
ns_marquee.left=marqueewidth+8
. y% M3 G, j* N}4 \4 h$ B2 N" K* q9 _/ f- t. G
}
3 M6 T7 I1 [' |% f' o9 z) o7 e M, ~+ u
if (iedom||document.layers){
/ j& W z. m, z6 W) k: k, {) E8 Nwith (document){
9 Q0 H( i% k' n& B5 tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); k2 v. U7 i# e
if (iedom){7 j; w( R6 L( v; ^; w# s/ ~5 `( ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. L5 `: o; `/ k- {4 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 b* y! C C) |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# d. g: v) N+ U& ywrite('</div>')& K5 s# z7 {$ @6 R' J. M, N
}
' p V- E! |8 f' `7 @else if (document.layers){# S m6 M* a* M# i: `" d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( V/ w6 t9 t3 v* lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( s8 u7 ?. j( J# m! K3 Zwrite('</ilayer>'); ]% S( w7 Z2 s8 s1 ]9 r2 w9 w
}
6 o& g% h# i& i( j5 Pdocument.write('</td></table>')$ n5 I5 K1 i8 f) B7 _
}; J# ]9 @$ Z& v. H5 Z7 o! q
}6 Q, n- X ~- Q0 n8 h( i+ v$ n
</script> |
|