返回列表 发帖

网页之跑马灯文字特效

//修改宽度% L- {- n9 K* P6 o. d3 {6 h
var marqueewidth=3003 k% i' a: t1 r7 z& q  }
//高度
8 k* o7 p2 v3 S& |var marqueeheight=252 ^5 J$ _9 D5 s1 P- ]
//速度(1-10)
4 A5 P$ E( o' I/ h) ivar marqueespeed=3
8 n4 a8 G: V8 {) R  Y# Q* w9 [//背景颜色
! _" D4 }7 g: e3 p% xvar marqueebgcolor="#FFFFFF": C8 `! `/ H  s0 p# L7 _& n
//是否能暂停 (0=no. 1=yes)?
; n* g2 H( i' z: t  y* vvar pauseit=1
" z/ l7 k& g# [5 h! V) s1 y' E" W8 e% q8 q$ K
//修改显示内容7 ]2 `) Y6 ^" W: h8 b+ p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( g: r' e) s- V' ?( y

3 A* g9 O8 P) j3 R/ i1 q: T' b; N0 |* S+ }
////下面不需改变////////////
' ~, }9 ^- R+ F7 Q& h6 `7 x
$ Q7 X2 W* X# M/ J" w2 Svar copyspeed=marqueespeed
& z2 @8 R+ G4 s6 C! E6 @3 {+ Z- Ovar pausespeed=(pauseit==0)? copyspeed: 0
4 N$ v1 ]) f8 G9 y4 c+ Gvar iedom=document.all||document.getElementById
/ Y' C* u9 o3 s, u: Wif (iedom)
- ?: B% @9 B* u; Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' o& z- T9 L: r- ^var actualwidth=''7 }6 i" t; i! \+ _% _7 ], r
var cross_marquee, ns_marquee
3 D$ h# L, P6 V: P2 P
- h( G5 d+ I$ V3 a& ]: ~function populate(){
3 F% l1 c0 Y& u8 f! gif (iedom){
( r6 r2 i5 L: r, Z! A( Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 V2 ?7 X3 q$ ucross_marquee.style.left=marqueewidth+8
0 h5 k8 Y1 \) G  m1 s4 k/ Lcross_marquee.innerHTML=marqueecontent1 h' L: ?. _. Z( l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 I$ Q$ F5 P  Z6 [, k}0 |1 b- L) I9 |
else if (document.layers){/ e5 u  ^  C( x+ r3 t# f* z. k9 d- y
ns_marquee=document.ns_marquee.document.ns_marquee2
/ c) z" W, `/ Vns_marquee.left=marqueewidth+8
, ]. F4 A. ]9 b. ens_marquee.document.write(marqueecontent), V$ ~, s* U! d9 N0 l. x
ns_marquee.document.close()5 D. k0 J1 i2 D/ l
actualwidth=ns_marquee.document.width! {1 w) y# H1 o7 ~& p
}
3 W* s9 S# w5 i) F& k) [lefttime=setInterval("scrollmarquee()",20)
. B  ?8 n: c  `$ l  U# p! _}# x8 t3 Y: `9 e: z3 v' y
window.onload=populate' w! ~9 x# c' t- Q# q
$ M% }! |0 \; B* Q; ]6 X  q
function scrollmarquee(){# o0 o- j/ ~  C+ r- K( L3 X
if (iedom){
- Y8 z0 H: S) x+ l8 M: {) r; wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 h6 o  q3 N2 ~$ |* L9 B6 {1 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: k9 R8 D3 f0 T' V
else
+ m, w) b% X# M3 ^: mcross_marquee.style.left=marqueewidth+8
6 @- t) g. Q. P1 I' }5 W' x+ B" S3 R. o' o
0 L! k0 A) b6 p$ m}0 h/ K0 I! J- y+ m2 l
else if (document.layers){: k* j6 w2 C/ ~5 H: m4 K5 Q
if (ns_marquee.left>(actualwidth*(-1)+8))# I% J1 w5 P6 F- s; [
ns_marquee.left-=copyspeed
7 T/ o* S+ a( D2 G: l; m' `: yelse! b/ [" L- N  C
ns_marquee.left=marqueewidth+8. [8 X/ C( C: Q6 Y
}0 c6 q- W6 o9 M
}
* C1 N9 G7 P  v9 S* W/ U
0 Q/ p% \$ }0 iif (iedom||document.layers){8 L8 y3 g' p& B
with (document){2 ]6 y& J9 j4 d8 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ W/ ?/ ]* M* g4 s1 U4 i7 B6 Zif (iedom){
: h* n7 x# r( c. u' C  Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 Y# g0 A9 S' G! j& E% t+ m' U- Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 ]. o6 J1 y: c: ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. Q: ?2 Y# U3 o. }$ s( w! qwrite('</div>')
; H; n# q( S& ?- N}
2 Z) O8 O- i4 K. E9 m- Belse if (document.layers){  T. p1 {& `+ D0 L4 v5 H& P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  ]+ F+ P! |& ]& H5 x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 @+ Q7 ]2 O7 @  Owrite('</ilayer>')6 H/ m8 V- o( A! t, X
}
. n% c) E! U" w; R( M2 O# W# [document.write('</td></table>')4 L: X- B: g9 f
}
! v2 C. Z7 H/ e6 s9 \! d}
7 a. V) A0 G! d" ]# Y) E$ t7 o</script>

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