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

|
网页之跑马灯文字特效
//修改宽度
! H' x# _6 B$ t# L, X" [) ?4 xvar marqueewidth=300+ V2 f, n% o0 E0 g$ q
//高度5 [+ i& U5 d( C
var marqueeheight=25, `, i7 ]" z5 ~4 K3 q" @2 {& Y
//速度(1-10)6 \* t) _$ S& @7 D
var marqueespeed=3
( a5 U7 V/ L" A6 Y//背景颜色
" G0 ~2 a8 l, J1 uvar marqueebgcolor="#FFFFFF"
1 ]9 N9 I& ^- Y4 D: v//是否能暂停 (0=no. 1=yes)?
+ D' F! q$ X- y# N' S( V7 Nvar pauseit=1
) J9 C6 N4 r$ V0 f9 A8 n# x" t$ M3 N( C" ?9 R8 b
//修改显示内容
3 C' W9 G5 R0 l2 a0 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 J S! i5 q, n3 y' h# S1 E7 B# a- k
" W4 X- ~8 r. P! a( |2 z
////下面不需改变////////////
$ ^- x8 U% M! c4 M- s$ M4 A4 H2 Z- P5 w+ Q6 V/ T z
var copyspeed=marqueespeed/ _ c* u( S# F
var pausespeed=(pauseit==0)? copyspeed: 0
* Z7 N, G' |$ `2 v H: }" qvar iedom=document.all||document.getElementById
7 q6 C3 ~3 Z. [- n& _) ]5 vif (iedom)
' }2 V$ `" z* M% w: N( odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' |+ x; d7 }: E# `, v" T& P( z
var actualwidth=''- B' K) A! D/ U9 |$ Y( e
var cross_marquee, ns_marquee$ _ K/ [$ l3 s
/ s' B% p6 B3 }8 |* lfunction populate(){; N/ e, p, q( N6 `
if (iedom){7 o+ I) [0 B$ i( ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& `, J# }4 B0 w7 f
cross_marquee.style.left=marqueewidth+8
" N& w( J# g5 n& K6 Ucross_marquee.innerHTML=marqueecontent; n }& ]9 S0 W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# f' |' v# T$ A5 P& F% Y, e$ [}/ `/ n& d& _ f+ M6 o+ ?
else if (document.layers){, K% g" O' F% w) e+ \. @
ns_marquee=document.ns_marquee.document.ns_marquee29 D7 T3 M! i! b H* T( [& w. a2 F
ns_marquee.left=marqueewidth+8* e* ?2 c9 X1 i- Z* b) q" f
ns_marquee.document.write(marqueecontent) V5 w! s7 {+ z5 t& Z. w/ c# s; Q7 h3 y
ns_marquee.document.close()$ @: L8 Q+ ^0 w( m
actualwidth=ns_marquee.document.width M/ l9 {( D6 Y& B4 v
}% ]7 ?4 m1 p) f$ M$ p
lefttime=setInterval("scrollmarquee()",20)
6 N% w1 B/ J( [& R! i}" U d& w2 p. m/ x U+ T. J$ X
window.onload=populate
4 Q& d+ U [/ l5 L6 W
( ^7 D0 z( b: n( s6 `function scrollmarquee(){
2 h- ^1 D9 c2 A0 |if (iedom){
1 ]& t, l* ]* xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ e }) x) j `2 B6 j# I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 X8 j3 P& ^4 D$ U. \+ u* ~else
0 u% o: D) @' @cross_marquee.style.left=marqueewidth+84 d0 D* b; e& ~9 _, x
/ Q6 }- m$ o' b7 ~- f' Q}9 I! y4 ~1 p4 @$ D1 ^
else if (document.layers){1 b2 i" f- J# {1 `. z# {
if (ns_marquee.left>(actualwidth*(-1)+8))$ v) s. I2 z! u) P* b9 p
ns_marquee.left-=copyspeed! U# {5 O) ?+ `7 ^
else
0 Z# S( v: @" hns_marquee.left=marqueewidth+8- f9 N* R/ s6 p
}9 X2 \! b3 t P6 T5 y9 @
}
8 ~; u4 {! Y* L
( `+ |7 t0 E( G, E/ ^8 p! y# lif (iedom||document.layers){
Y6 h$ V E9 B y' Q" N7 Swith (document){& k6 }4 l+ v2 ]( |& ?. z& f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( W* ~) I5 T4 W- ^& Pif (iedom){ w% ` S# C) Z' p. C" Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% |2 e; I8 C( f+ d( r( P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 a2 `7 O* S1 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 q/ M9 E) I- A% E2 [' Y1 A/ g8 jwrite('</div>')6 S* y6 ^1 h- Q6 N- O
}6 g1 j& M: P) X( e* J6 E
else if (document.layers){: j! u. `4 {; L5 S3 i& i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 t: s) {2 U u, k! Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') l( \4 a4 h8 W
write('</ilayer>')
1 x* V5 _# I, J6 z, ?, V* ~}" u) |. c3 ` z& Q
document.write('</td></table>')' _* `% _ v3 I9 v6 a
}3 h i% p8 d) x$ Z; [! a
}/ A s2 C; ~! L3 O) {" \
</script> |
|