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

|
网页之跑马灯文字特效
//修改宽度
0 ] n' P6 d G. J$ F" n/ ~var marqueewidth=300( c7 u( T- ]9 K F& _) M1 V
//高度! G; a7 F2 e4 `2 F4 o
var marqueeheight=25- z# r5 b5 K0 @. L. @) ?
//速度(1-10)
* s- E C, j$ A |* ?" {var marqueespeed=3' k' Y( [5 [6 h( X. A9 A( C+ j
//背景颜色
, { R( O w8 f6 tvar marqueebgcolor="#FFFFFF"
3 l+ a9 w, D3 ^2 A2 [$ I# g//是否能暂停 (0=no. 1=yes)?# N: q- @6 ?7 j, J1 W% H
var pauseit=1
5 h# ]) @4 H' Z& l' _# H2 l* i, m* M8 J/ O/ S
//修改显示内容
0 }' c9 D6 h9 W# F" ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' d' K) L% I9 N# t2 g" q
" I8 q) O( o6 m2 l1 `4 w1 p% ^( Z- B' ^
////下面不需改变////////////& i% J5 C' }. d1 P
; W; b( z& [) |; V6 k; U/ k" ?var copyspeed=marqueespeed
( q3 a; F: [& T' s; o) svar pausespeed=(pauseit==0)? copyspeed: 09 h' S1 s4 t( X f
var iedom=document.all||document.getElementById7 E$ ?' ~6 m! Z
if (iedom)
) C \- I6 T! a9 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ T( ~2 o& e" P% J, V( x/ r7 e
var actualwidth=''
0 G+ i2 i5 N9 H1 f8 ^; V2 g8 Hvar cross_marquee, ns_marquee5 A- q" A& X; w3 W! ? Y w
, J: d% f& g2 |/ o+ r8 @: Dfunction populate(){
) ]6 W7 W8 H! @4 T9 ?if (iedom){
; t \# I4 C. H- F3 o; K3 w. w$ l& Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 R* Y7 {6 o' U$ X" O3 s9 wcross_marquee.style.left=marqueewidth+8$ d% r5 _% ?. X! {; f0 U9 v
cross_marquee.innerHTML=marqueecontent; K4 O! N# E) F: X: f% R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- B9 v( k* D2 C; W}! i, G7 G+ [3 ~0 V
else if (document.layers){2 }) R V; {+ z# J) k
ns_marquee=document.ns_marquee.document.ns_marquee2
4 W4 l; V- q6 Q e7 hns_marquee.left=marqueewidth+8. D$ r: H j% @6 m" I% E% I
ns_marquee.document.write(marqueecontent)
3 A' Q! a5 A; P- uns_marquee.document.close()& R' Z% e5 z9 y
actualwidth=ns_marquee.document.width
+ a' V( D+ W$ W9 f I}: I0 D: e: T0 w; I
lefttime=setInterval("scrollmarquee()",20)
& E; G8 G. M. `, @4 d; d+ v}
+ m/ o7 i5 k/ T) cwindow.onload=populate
* \- b8 i: C8 C3 r8 T
* [, I d9 Y4 r. G4 B; l, Y: x# ifunction scrollmarquee(){) G5 W: v+ L4 a4 m
if (iedom){
7 r. A, d) [+ g& ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 r: s: m; W4 J5 Y: T1 b9 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ |. v' K: L- ~$ L
else% s3 |3 F1 z% E9 q
cross_marquee.style.left=marqueewidth+8
) {7 b, l0 n$ a$ |' X7 P4 Q8 t8 I
}7 F1 I) o, K' T" d+ \- g h! v: y' t
else if (document.layers){
6 e* Z7 O3 W" ?0 o' c" }' X/ Z. oif (ns_marquee.left>(actualwidth*(-1)+8))
- I6 l3 y: j( Y: ^6 Wns_marquee.left-=copyspeed/ ^4 E8 C2 j3 b8 F( q, s8 ^5 g9 K5 ]$ e
else& v! r8 ] `6 B# X
ns_marquee.left=marqueewidth+8
* y* P0 B7 }# |- w& X}
! ~( X. A o* P' O, A, q}% V7 | r% v, T7 t
8 P$ z% g) S" i/ uif (iedom||document.layers){7 C& q, F A6 {: r0 @: V) |, W
with (document){9 b: n- L" Q; W" N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 I) m' \* T! m% R" qif (iedom){
9 V3 O2 {3 A u; Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% y- T7 M8 R; ]# Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 Q3 T- z, l/ d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- j- E0 i# B$ W: ^' h1 R! C; D1 R
write('</div>')6 G. k# D; [) @
}
, b/ O: d! b* H) qelse if (document.layers){( @- z2 V8 [: Z- I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 p" L+ {8 L4 Z1 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- C( q. r2 n( i# ]0 X0 ~& Ywrite('</ilayer>')$ |; x' G$ j$ z/ j m6 t$ M
}
) h/ ^% _$ W, R6 W2 Fdocument.write('</td></table>')! b1 @1 z" |' w* F- t6 |
}
* G9 u/ m- y/ U, e* W}; K$ S+ B+ G% n, x$ u+ D0 S
</script> |
|