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

|
网页之跑马灯文字特效
//修改宽度
4 @+ g" Q% u: s" {5 X" z4 @var marqueewidth=300; y: `5 G. Y) @; N/ T; W
//高度
( D+ G; |5 N( lvar marqueeheight=25
( ^9 D2 V1 `& W# B6 q//速度(1-10) f8 }- j: T# l
var marqueespeed=3
7 V$ B& ^8 T, l# c//背景颜色
3 q0 O) D& T- X( _var marqueebgcolor="#FFFFFF"; k$ |" Z+ k+ e7 m8 R3 E4 F
//是否能暂停 (0=no. 1=yes)?. E8 v! ]$ f( A- c
var pauseit=1
% R% d! W- S l5 m! @! r' I/ C2 E' W4 l$ h
//修改显示内容/ G6 o& f3 a0 T5 E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. `: t& u# W! B% l! Q: I
J8 q: k( a* n
( C, P+ S$ ?# r% t: t4 x////下面不需改变////////////7 m4 r: L- a7 O
5 A/ P" [( p- d& l* @var copyspeed=marqueespeed
# x4 {! r" S% i$ p7 ~% @. dvar pausespeed=(pauseit==0)? copyspeed: 0! k- o' P$ m; [. U9 `' N! L0 ?
var iedom=document.all||document.getElementById# a' z+ \1 ?+ d; h
if (iedom); s# e$ u! o( J4 D0 I5 U l P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 i8 R9 y+ c! `& K
var actualwidth=''/ I+ \+ ?/ Q) v8 I- G4 @* p9 G
var cross_marquee, ns_marquee
1 l" M! M0 j+ X; ~ s b
$ _0 j8 C$ x3 Qfunction populate(){
0 R! C h) K( p6 v* }8 gif (iedom){
. Y- N# i; p; b) h* fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, i& N+ E" |$ ~1 [% y/ Q0 Tcross_marquee.style.left=marqueewidth+8
$ v( ~# t1 c) [9 c3 j' V6 Kcross_marquee.innerHTML=marqueecontent; J! O' T6 \3 R% f( {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; E7 g6 Q0 X( f7 D2 F7 Q}8 i) C. [6 q" ]( g, h6 ~
else if (document.layers){
2 S9 r& C$ G% U: ]ns_marquee=document.ns_marquee.document.ns_marquee2
% i, c1 y4 h: {, `, mns_marquee.left=marqueewidth+8: a5 }5 B& G" z9 @/ A# Y
ns_marquee.document.write(marqueecontent)6 Q$ y; ?# j( U: R/ Y- B0 \( I
ns_marquee.document.close()
8 k$ O7 j! e: iactualwidth=ns_marquee.document.width
3 T; s: [2 \1 t5 E7 m}
; q3 d, |4 {1 ] i* x/ Ilefttime=setInterval("scrollmarquee()",20)
+ d5 K% c% n/ ~ f4 g: G}
2 |% j$ j, i$ s" a, a2 Swindow.onload=populate; ~7 j; |1 i1 `
0 m. g* j/ B( ]5 j/ l
function scrollmarquee(){$ W$ ?* F0 C" }2 B! R7 @. G
if (iedom){( S$ B0 a! O* l$ U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; D* V0 u* K7 `/ d% ?, J( g- q' ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 S( O4 T3 _- p) ?* x5 y
else
/ D9 c, ], H6 M1 g8 O! }cross_marquee.style.left=marqueewidth+8
# ?+ n3 Y) C+ o, p9 Q$ S6 g2 G7 ?9 t
2 J% Q8 s* h2 M6 D$ j1 O% ^}4 |! ~2 D- b7 S& ~
else if (document.layers){
x0 \9 D$ s! }9 d% A, zif (ns_marquee.left>(actualwidth*(-1)+8))
; l) _: V0 N1 j$ w. u2 Ins_marquee.left-=copyspeed# q- f* Z' v- y* U, J i3 C
else N/ n+ e" o$ W7 N
ns_marquee.left=marqueewidth+8# Y9 m7 ?& w" I6 h; t
}$ |4 I0 w, H& ^: C1 |
}; z9 k$ \- e( j; `0 ]; `* k! ? B
; d% [6 r2 U0 T) @
if (iedom||document.layers){
7 Q9 K- @* u3 Z( ?with (document){
) n+ W4 \& H1 \1 Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 A; o# f1 M( t. Y# S& Uif (iedom){- f7 h% o' }8 \+ ~0 U/ M8 |' ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- a7 x( Y* z' C0 f9 [+ `8 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( x5 j1 k8 {1 K4 u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ P) p2 y* N( l' B. r1 A% Y0 Fwrite('</div>'). L" P# h1 h2 p% [7 a+ I: `! K8 F& ]
}. n' `3 o- j+ I
else if (document.layers){
6 G& T- M" u' s! w. c5 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 `. X; Z+ z6 f' a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 l; k3 L; E+ Y* T) o) r, \write('</ilayer>')! k& B) h' o$ S O
}
# d$ T! G8 v, ]; z2 idocument.write('</td></table>')6 n2 K2 y* A8 L
}
4 Z$ c4 {! A8 [}' W: @4 F5 r; _) p5 u' L2 x7 k
</script> |
|