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

|
网页之跑马灯文字特效
//修改宽度9 p! d7 j6 n* S. m
var marqueewidth=300
3 n. j& `6 ]: {' q" ^/ w//高度
5 n& b0 D* d( S6 Q# X; b7 vvar marqueeheight=25
) p6 Y5 {4 E" h0 p//速度(1-10)
2 Z6 g2 V4 s; n. L! w y0 @var marqueespeed=3
- ~$ J6 R- j t, Z//背景颜色9 r% m; M4 H: r6 \- ?8 t
var marqueebgcolor="#FFFFFF"
# N% M% n+ H- \" \. K. Q//是否能暂停 (0=no. 1=yes)?' y4 K8 V) {. ?$ ^0 K5 \
var pauseit=1
8 ^5 @( @' F7 | I4 B K$ O( L# W3 p8 L5 a, {; b2 ` A4 V
//修改显示内容
" ^, [! |2 h, n" p& O5 [: Q, Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! h9 m* O: G0 ~+ x7 u$ |4 \, j
! Y+ n. q h; r# I; p
" V, k' U, | i! ~# p////下面不需改变////////////
8 K$ a. {4 C- s3 p' Y t& J V5 Q9 L3 [$ {; M! W# L1 o$ g
var copyspeed=marqueespeed
+ U! G2 y- e. {' I; \var pausespeed=(pauseit==0)? copyspeed: 0
x; Y5 \4 ~1 r% y V+ Svar iedom=document.all||document.getElementById8 ?1 m6 y5 E8 p
if (iedom)
9 L' S/ u9 A- @4 C6 b: xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& Y% ?* k( M6 ?. h l& c* ^& t7 Svar actualwidth=''% g) Y* b9 z7 u- z3 Q6 S& m8 r
var cross_marquee, ns_marquee* i5 e, u1 e& {& H" L
( |. I. l7 H" K0 `5 h, Dfunction populate(){
- q ~1 w% p. O# V5 y5 Uif (iedom){
@) c- V) m8 L. t5 o# R. Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' v: d! \. v/ Mcross_marquee.style.left=marqueewidth+86 b) ]3 Z8 e# Q' w' T
cross_marquee.innerHTML=marqueecontent8 m L" e# N& \0 ^; E) i9 }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 R, P7 C% z/ B
}% C' W8 b+ H: f. y% N% F9 u4 E4 p
else if (document.layers){
) c4 h! z3 Y J6 Kns_marquee=document.ns_marquee.document.ns_marquee2& i) o0 J6 |; ]/ R9 ?# n
ns_marquee.left=marqueewidth+8
" @+ J! U4 _% g3 X6 o* g5 Tns_marquee.document.write(marqueecontent)
/ r( K( t. }6 i2 b( dns_marquee.document.close()
) }8 Q: I" Z- B; r2 }& mactualwidth=ns_marquee.document.width3 N1 |# G7 I! Y" s0 Q5 b7 f
}9 _: [; z7 P X6 K) g; N. k
lefttime=setInterval("scrollmarquee()",20)
( m6 \8 O: x% i' E1 r8 B( P}
" y0 P2 b. N8 Owindow.onload=populate, R, Q4 ]" O2 `9 m# O' D% ^) w) t6 i
G2 R. C8 p8 c6 O% ~8 ?7 S2 U& z: N3 \
function scrollmarquee(){/ |. b5 C! |9 O$ n
if (iedom){0 [. Y$ ~4 y+ {, G+ }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). r5 n/ o% u* W8 a; N9 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: y6 S. c: _) _: F! [: c. gelse
7 s" n' q' N/ }6 w/ e8 Kcross_marquee.style.left=marqueewidth+84 ^1 W+ L8 ~7 a7 j. }
4 g% c. B! _& z& _: J6 b" M3 ?+ Y
}
# ?1 W# I1 [( ~0 f2 s/ ?else if (document.layers){$ B/ W1 ^$ x0 C
if (ns_marquee.left>(actualwidth*(-1)+8))9 h* K) t# i' L/ `: S5 e$ u+ l
ns_marquee.left-=copyspeed+ g+ ~8 Y2 b/ I% _5 j( |2 m b/ U
else9 W; R# }7 z0 g( c! n: q9 G" Q
ns_marquee.left=marqueewidth+89 U, J- n3 j7 A
}
4 D% j5 k, V' ^# C8 Z8 n7 D}& L# o( j9 F* K2 o+ N: Y
) P# i9 @( a5 i# V. _9 r+ A% d
if (iedom||document.layers){
F, F$ K6 R$ g* z% l. x3 Fwith (document){
2 e0 B0 A) X/ Z2 C8 q8 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 v& s& I) D0 a" u9 m; Lif (iedom){
& ]5 X7 G2 ]$ A* uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 h0 G5 Q8 \) `" a& s& \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' I n/ _* a. c, Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( K& G7 H8 N0 F
write('</div>')
0 Q4 S# T* z7 z5 ?: x}
! z Y1 X0 o8 J8 L5 `else if (document.layers){* D, U p, I; }% X; s# ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) c* O3 Q% f; _/ m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( ]2 `; o+ W' A- C7 ~8 E: U
write('</ilayer>')
5 m& T' _# y" W# s1 ?8 ~8 G# }}
0 x9 l* f% g4 C3 Q5 D% R Cdocument.write('</td></table>')
8 _8 C* y1 `, c f. K* K! y}
) \* h# \4 E% |- }7 A}, I2 i5 Q' ~2 |( I% b
</script> |
|