返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 h6 N4 ?6 {" R4 F' Z! ?
var marqueewidth=300
5 C- b. B6 H0 n9 q4 \) k+ f//高度$ }6 I  H8 G5 a0 a
var marqueeheight=25" r/ W; r! b- U% F% z
//速度(1-10)
) m, ?1 A+ ^, |: E5 tvar marqueespeed=3, ^' r3 S& C, U+ X; y
//背景颜色
5 @" ?5 n$ |1 ?; l; X+ V& P- z$ lvar marqueebgcolor="#FFFFFF"
7 i, m; |# X/ {: j0 h8 }* V! ^5 L//是否能暂停 (0=no. 1=yes)?
+ |/ l2 ]6 H* L% z9 T0 p5 wvar pauseit=1
' b6 a/ R0 H9 v: ?- Y: R( w
" f3 X1 A: ~# M' f" I//修改显示内容* E: [% P1 f; c, v3 a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. Y( ?5 \( P0 H4 v1 C. V
$ ^, i# O- A7 p4 G) v4 |# k* _9 n" Z# p
////下面不需改变////////////- a1 [$ V: s$ D# h

3 f, U( p3 T4 q) xvar copyspeed=marqueespeed
0 y; s- h) J6 h3 b4 ^* ~var pausespeed=(pauseit==0)? copyspeed: 0
$ C6 e4 J5 P1 nvar iedom=document.all||document.getElementById8 B5 M$ `. t. N5 g' w4 i
if (iedom): B, I. Z( h1 S* K( j5 `3 l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 N8 g7 `% g% T" L  w: nvar actualwidth=''
/ C" W6 T. N  i; Y) Mvar cross_marquee, ns_marquee
8 p7 w2 @9 r; Z- U* A/ g0 S/ p3 L% Y7 o
function populate(){; f; z+ d8 R  j- i; Q% P- k
if (iedom){8 f' V0 k9 T- J) c/ q7 x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 l/ Z6 D5 W( K( @( f. Zcross_marquee.style.left=marqueewidth+8, `! M4 S; G+ ~# ~1 E- k% F! j
cross_marquee.innerHTML=marqueecontent4 Z0 i+ o/ J7 v( I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( }# G! B1 Z! {+ i. O5 B! v* ]* O}
) z8 Q. g3 x9 W( velse if (document.layers){
# o. ]2 I. z6 J/ n, Xns_marquee=document.ns_marquee.document.ns_marquee2( i1 D6 C$ A- i; I* I
ns_marquee.left=marqueewidth+8
! ^. R. b5 B3 W/ }7 M1 sns_marquee.document.write(marqueecontent)! f2 i/ p' s) T/ b. H: h
ns_marquee.document.close()
8 a6 ]% m, ?2 s$ {actualwidth=ns_marquee.document.width
. g! {* V* e# u: A3 V. b* H9 ?5 _}
' q7 S5 E* q8 \" q9 U9 G) |lefttime=setInterval("scrollmarquee()",20)  C  Z: K) N2 }3 b, z8 ?' s; W
}) w9 X& v: t0 J* S
window.onload=populate5 F6 _  u) _0 c
' l3 a) f6 t2 i1 Q6 v& B( G2 C
function scrollmarquee(){
) |+ g  U- l7 l& d4 K. Eif (iedom){
& H. y; O$ [1 l/ `: ^/ p" A+ F! \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( w! ?+ F0 Z7 Z8 n9 d$ a' j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 F9 R7 j! e1 O) ~! X! lelse4 n( M! _% u2 i) g
cross_marquee.style.left=marqueewidth+8$ Y& ~' o/ L8 C* L, k

4 q& O, @. X1 k. h  P}2 i, A; a+ Z+ `: M- m* A+ o- E
else if (document.layers){+ G2 H, W9 m2 Q
if (ns_marquee.left>(actualwidth*(-1)+8))  o' G# v$ s$ |
ns_marquee.left-=copyspeed$ i: e6 i1 Z0 L; a8 f
else, T5 D) }& {/ m, g" d. {7 E! D
ns_marquee.left=marqueewidth+87 t3 {7 P1 ]; `8 k6 ~
}
0 p1 p* F0 y3 `: a- t7 p8 F}
! p0 N) B% M  W& u* i7 Z: \. O; T3 @# V, u
if (iedom||document.layers){
1 @( d* s) ^7 a; g7 Fwith (document){
6 w# p6 M( |: g' V/ A' d7 Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- [1 l1 S2 ^9 [' Q2 l$ B+ e  X
if (iedom){/ O: Q  R& G# x/ P  G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 ~$ C3 [% |) c+ y! ?3 V5 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  k; I4 m) P9 g( m1 r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 T+ R8 r. J0 ~* }; mwrite('</div>')
1 m0 r. I6 \2 B5 E}
1 O  d  L' t' t" X( v4 A) {else if (document.layers){/ q8 G$ _$ c4 `' z% D5 ^( b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: v# c: W/ N/ V) R* x0 B8 m5 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 {6 i2 X) c: w# X6 W" l; t9 Bwrite('</ilayer>'); I: E* a4 J6 P: w% d7 d6 b7 I
}; ^6 l- q' K0 c2 E! N* }  t
document.write('</td></table>')
1 \: d; D3 R3 e( ]% W3 T}, f. B4 K' K+ o3 Y; ]
}
; ]' l0 ^& I  _</script>

返回列表
【捌玖网络】已经运行: