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

|
网页之跑马灯文字特效
//修改宽度
8 Z4 ^, d: o# J" ]3 k1 R# d9 V cvar marqueewidth=300
& o% y6 s A# U4 W4 Z- p//高度
3 r- G7 r6 y! D* |) p8 f* |var marqueeheight=25
/ t& v6 v0 W3 @8 D3 y//速度(1-10)
$ n1 a1 l: Q% l3 _var marqueespeed=3
0 M. U4 B' N$ l# M" y8 k$ X//背景颜色) m0 Y; Q+ N! w: z# v$ L
var marqueebgcolor="#FFFFFF"
! \3 l' N9 c$ v" @3 Q! S9 ~, C//是否能暂停 (0=no. 1=yes)?* _- w. p' C$ g& l* {4 f8 j! T6 z
var pauseit=1
- M# V7 j6 K- _% ?7 O2 |( z6 E4 h' @$ c* k8 L6 ?1 p
//修改显示内容* R$ g* m( [2 ]( U- v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: L7 S- Q. O( G5 Z; M& w1 `0 ~
9 q" B; N2 I' c/ f
/ e1 b; u$ m1 Z. I1 p9 U////下面不需改变////////////8 q- V' s' n0 C- e9 H. S
( V8 |$ b! h5 C) Jvar copyspeed=marqueespeed
7 n( Z/ A/ T8 Zvar pausespeed=(pauseit==0)? copyspeed: 0( w {7 Z y# [, T; \# S- t# h$ D# J
var iedom=document.all||document.getElementById, n1 ?. s2 Y& ~' c. A
if (iedom)1 h8 b, P' T; q' }' I$ h3 p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! }% j4 M+ ?: |3 O- Z" c7 V3 m9 }
var actualwidth=''
1 q! h3 w+ q4 Avar cross_marquee, ns_marquee
i/ Y9 ]6 z3 s; I( _
, _& i Q9 A) H7 B# E* kfunction populate(){* M9 o) V; i9 X2 J( j& W5 O
if (iedom){
2 x; T2 _! z* f Q! b- Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: `# t, L* h$ tcross_marquee.style.left=marqueewidth+8
- Y4 J. [$ q$ O6 xcross_marquee.innerHTML=marqueecontent
* s( [2 h7 t6 L( Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: q5 q5 v( Z5 c$ @0 r! x' s9 o
}) C8 e2 L: R$ B- L) U
else if (document.layers){
; }/ ], R7 t" c) Ens_marquee=document.ns_marquee.document.ns_marquee2
) m5 |8 V* r2 K1 V3 N: h/ Sns_marquee.left=marqueewidth+8) r& O9 @: _1 ?# ?( U3 l) h
ns_marquee.document.write(marqueecontent)
4 e5 [7 ^4 f- Ens_marquee.document.close()
. f; X0 a8 G1 O) h. Factualwidth=ns_marquee.document.width
6 ]5 _3 R8 K0 w( A8 q( d}
+ f( r$ ]/ |. p% R, Ylefttime=setInterval("scrollmarquee()",20)# e' ~( Q W2 p) @; C" @8 Y7 d9 ]4 b- ?
}/ y' F+ n7 b( d
window.onload=populate
7 j/ E; k4 z" y
( \2 u8 q* n: W% {: T6 |( s! rfunction scrollmarquee(){
: z# O( I+ B9 V. e5 r0 y( Fif (iedom){
0 C4 z2 {' F2 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) |9 O1 y" C7 q p3 w; v# V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 C" S: K, f6 k8 V
else
' r6 Q F+ L. y, A+ h. Scross_marquee.style.left=marqueewidth+8: [+ D& `, Q2 _, e$ ?7 @5 P
4 V: M0 a1 R$ @% W m& i/ h}3 X3 H- U+ S) C6 S( h
else if (document.layers){
: ]( ]6 q* a+ v9 [1 |6 qif (ns_marquee.left>(actualwidth*(-1)+8))
# j) z$ W7 f5 v' M/ qns_marquee.left-=copyspeed
0 n; Z) i2 { ~9 Q0 `else& U: U# \. i# D5 o
ns_marquee.left=marqueewidth+8
Q7 @9 r. {/ \/ d- w- i}& s! u8 F$ e( p K, h, |) k
}
" N* i* z# r, F( O7 {6 u' U+ \9 P& b6 x! V5 G T
if (iedom||document.layers){
+ m! g# A9 [3 Kwith (document){
/ O' k. W3 a& I# ^; V( f" ^7 i. O/ H2 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 K5 y- Z- L+ ^! w8 O m# rif (iedom){
$ ?+ r2 v# E; ~8 A/ nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 T) l9 J6 j2 j' nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). v* e9 C3 a! L1 {+ Z8 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 _( O' [7 N3 W! p% S* \* Zwrite('</div>')9 D+ R1 Q; s+ w" t- \
}
$ o4 q8 N( j( C, X+ Oelse if (document.layers){
5 Q3 c2 @8 L5 ~( b: v: `" Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' \7 l+ F5 r- [ K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); q* q+ z* c6 R! s3 R
write('</ilayer>')" ~6 f: j3 S$ g0 F) i
}
" S# h& j% {' T5 \2 H) c1 F5 U! ?document.write('</td></table>')! p! _0 S6 B6 H" m9 C
}
4 Q# [& V, B. X( t3 a; p4 Q2 o$ T}6 m. ~/ g; ]% T! l, E
</script> |
|