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

|
网页之跑马灯文字特效
//修改宽度
1 j- z1 G! I# q" y$ L5 B! xvar marqueewidth=300
2 F# R) k, s) U% Y* [//高度6 O* Y. R9 Q/ H0 f B
var marqueeheight=25
; I+ K. q3 D m3 p0 c//速度(1-10)
% t7 w. u8 Z$ xvar marqueespeed=3. f( J9 r& i: z9 m
//背景颜色
0 i) V; D! y# O# @9 O: F: x- y) yvar marqueebgcolor="#FFFFFF"
0 k: p/ k( u4 b, D//是否能暂停 (0=no. 1=yes)?; H0 X. w) M* |; G
var pauseit=1
: w! }$ v, i' X, M0 |/ D; F) R
3 b+ K2 s1 F8 {# B( k: X//修改显示内容% J! x0 ]2 r( q7 ^" D9 z* W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 n3 D, e v( ?$ @" z* H# g
0 O, d- g: Q. K2 B3 c. ?$ U) z7 U( \( L4 ?+ B7 k2 y
////下面不需改变////////////
5 t6 ?7 d8 S' Y4 k5 C. Q5 o7 b- U" Y9 i7 T, Z* {( r: P
var copyspeed=marqueespeed
- u2 K1 b; G {var pausespeed=(pauseit==0)? copyspeed: 06 I2 R& J* \4 k/ V: l
var iedom=document.all||document.getElementById y, b' B, [( O$ N9 g4 n
if (iedom)
5 h9 ~; }( Z. G4 ^ adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 _/ @- w& t, s& q; r! y" A
var actualwidth=''3 L9 B4 V$ A+ W& X# Z k
var cross_marquee, ns_marquee
' J* O1 q2 ^" |" p! J
" R0 E' P" B5 \' t* U; h( wfunction populate(){
5 S; L- B0 f/ g: Xif (iedom){4 C7 A) X4 F$ P% B8 g, e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% `6 d: S: ^/ B
cross_marquee.style.left=marqueewidth+89 Q- a! ^3 W" W3 V) T
cross_marquee.innerHTML=marqueecontent
% r. U$ _% `$ b, y# k- lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# q% U1 e+ g+ l& N" G `
}
4 _5 C( d' `! N0 ~4 S$ a- E- delse if (document.layers){
1 ^6 o! Z- c; r+ u$ Yns_marquee=document.ns_marquee.document.ns_marquee2- ?4 a: a# o2 D0 x+ u) }& N
ns_marquee.left=marqueewidth+8* G! X2 Z. e6 M6 [
ns_marquee.document.write(marqueecontent)
2 Z4 ^5 A! i# [9 o- h# y8 qns_marquee.document.close()
# Y) Q) A w: x% o4 |; l% ?% mactualwidth=ns_marquee.document.width5 W4 z+ p9 x. u: [0 a" H) ?$ M
}
/ p! W+ W1 X, S+ xlefttime=setInterval("scrollmarquee()",20)6 j6 o2 q, J9 d/ k8 V) n
}# q4 d+ p9 g4 u2 v% {2 l' X
window.onload=populate( W/ G6 {( q6 w2 D$ ^5 h" {
) a! Z( O* \$ h/ e: @function scrollmarquee(){* J7 O3 m! B4 Z7 L* J
if (iedom){/ q' d3 `1 q( d% w% M" G1 b7 } H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 Q) C4 p' p r. X9 pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 ]' n( S# s8 u0 C5 qelse/ _ m6 c2 `2 a: z/ l* C6 S6 D) X
cross_marquee.style.left=marqueewidth+8
3 O1 k: |7 h2 p Q8 B! T4 t t K' N$ T) ?6 g, T- Z6 I
}0 b3 K, G% {; J) N" N+ X0 i
else if (document.layers){
& W# k! z; u+ E2 ? yif (ns_marquee.left>(actualwidth*(-1)+8))& d" `) b* y6 \) T
ns_marquee.left-=copyspeed
) n6 ~/ t. k& ^7 x, V1 s4 F- Pelse
' P5 R- Y( c/ l; K* }ns_marquee.left=marqueewidth+8' F! T8 a2 S! x- u6 _
}
r! h$ K% L6 N+ ~- Q4 f2 N}* D A i+ v0 Q6 S1 z1 l
: W) P. M, G) P' C; a
if (iedom||document.layers){
+ S9 ?! u5 x2 h8 Ewith (document){, `) p4 `' Z5 e' E7 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# a) ]6 p; ]$ qif (iedom){3 [: q; |% z1 I/ a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( v0 D9 P M* j; xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. O- Y6 z* l( D1 S$ Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 e% s* J1 f u3 {+ @1 i W
write('</div>')# M" L) Z' t9 {+ P3 ]
}0 f1 G$ n# `% i
else if (document.layers){
) X( ~2 A2 l8 o" ^) ?! g! |3 hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 z( i1 z. M0 S% twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') n& @; x6 i+ }4 N( x, r, }9 A" B
write('</ilayer>')5 U' l& q# y3 R4 I$ w
}
) b: j$ a' J+ t ?7 udocument.write('</td></table>')
& f* N" V, r7 ], Z$ k+ c}
( S9 O8 Y2 [3 b. ?+ {}
4 X2 C. Q( N; y5 V2 N9 y5 q7 |</script> |
|