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

|
网页之跑马灯文字特效
//修改宽度
6 ^" g" A; u7 B1 z* R8 P Xvar marqueewidth=300& R1 Y% {9 F1 ~
//高度8 O3 g" @' C$ p
var marqueeheight=25" V4 C7 e* j- S
//速度(1-10)
0 G* }$ p2 h, Z3 Wvar marqueespeed=3) x: l* B4 l1 r" t) i' r G
//背景颜色
- q( T: _1 I; t5 {8 Qvar marqueebgcolor="#FFFFFF"
8 a w8 b- S+ S1 n3 T0 u5 w. @//是否能暂停 (0=no. 1=yes)?
4 V! u$ x; Z! v! Evar pauseit=1
& z; |2 i0 z: c# F7 g+ f/ \. k3 b A+ I/ `) |" e& u
//修改显示内容! k3 f* F4 k% A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 v2 M* W+ X' D- ~- _
$ u2 l( y$ H9 {2 u; v
3 H. Y3 E4 Q# E7 n1 n////下面不需改变////////////6 Y: ]' }0 d2 h) s( V1 v! m- b
- L9 h! e" ?" z5 w5 A; L% y6 k
var copyspeed=marqueespeed
# j" `+ `; m5 b( I; Q+ k& t3 avar pausespeed=(pauseit==0)? copyspeed: 0' U4 @4 P% K# I; ~& c( X
var iedom=document.all||document.getElementById
& s/ S) H$ G+ @6 Fif (iedom)4 p* G: b5 F! |* g' t$ {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). x# M0 {9 [) m
var actualwidth=''
) Y6 X2 e7 O% L5 P& Q$ N+ W- s# V9 qvar cross_marquee, ns_marquee
4 s% _* m, v3 S) u2 {' a! u; c2 p$ l
function populate(){2 p+ C1 e; |% @8 B8 V& D
if (iedom){% D6 R2 y, @0 l$ Q7 d* A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 R/ ]5 {4 h6 m3 m" g6 hcross_marquee.style.left=marqueewidth+8. F2 n9 U$ l% u9 Z. }1 n' X
cross_marquee.innerHTML=marqueecontent% W) J5 f \3 M! P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: T8 `- o$ |! o+ ~' O# E/ A}! N3 e4 O8 K3 f0 x' q
else if (document.layers){
/ c; Z6 T7 n1 N7 C, g( Qns_marquee=document.ns_marquee.document.ns_marquee2
0 ~% C+ t+ d6 Z tns_marquee.left=marqueewidth+8
; P8 e, K+ l6 P8 Z0 {+ I% d! G: Qns_marquee.document.write(marqueecontent)0 e& \, R( A( t
ns_marquee.document.close()/ D2 l8 L( _: G% w- ^7 A9 R
actualwidth=ns_marquee.document.width
/ }3 I4 d, @/ f# N}$ J/ `" g ~& H* v
lefttime=setInterval("scrollmarquee()",20)% {4 T: V# r$ G S
}
1 i( e! K* R0 o3 {" ]window.onload=populate) V/ `/ C6 I* Q; R, j4 a( Z
4 [" J( f% }' ^function scrollmarquee(){$ ?, V: Q7 ]1 B2 N
if (iedom){7 F2 f1 X% c. o% e+ S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 O5 n% j Q1 u: W2 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 I- z- e* ?' ^# _else1 ~' z, F& r9 H
cross_marquee.style.left=marqueewidth+8+ _: b3 w* }4 f4 [
6 b( @' z- @) Z
}4 g0 I3 l$ m1 V- H
else if (document.layers){
v9 d# T/ |% V' n- Bif (ns_marquee.left>(actualwidth*(-1)+8))
" H9 v* q3 x- S! T) ]* Xns_marquee.left-=copyspeed1 o. [. ?9 X) j5 N( s7 W" E. S
else
% ]$ [ e6 [! I8 z. f, ?ns_marquee.left=marqueewidth+8
! `* [ ^3 F# H3 N' n}
! }: \6 _) t) s( `0 P; L5 G3 y9 k, ]}9 x: a+ e: ~6 f; l
- o3 W- E8 M" }% k. ~0 _) e( zif (iedom||document.layers){
' ]+ L; H: g nwith (document){
7 Z0 ~2 s7 [! e! ^8 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& m1 G, h# b( [* k- f% ?' x0 T
if (iedom){2 {: `7 c- ^, ]- m5 \3 d. k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( y/ J4 Z/ e6 J4 C1 A! r) p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, y. H9 N% n* B2 S$ swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 w4 C2 K% a/ P. C: S, z
write('</div>')
) P% g, s" U0 I0 ~8 Y+ E& f# w}3 m# q( B3 S* s9 S3 f
else if (document.layers){ L3 U! q# M; t( G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 N! E: f: d# O" a+ y/ ]+ q; W( \1 jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' b5 K/ \4 m8 i7 I. h5 {- x4 ^! R
write('</ilayer>')$ Q2 G! E n8 o2 D
}
j+ F# E! G7 c$ R1 ?$ \document.write('</td></table>')! E* g' _! o2 M+ J5 f
}
( F/ R* j' v$ U}- ], o4 o# a$ e6 Z& M: A
</script> |
|