返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: K8 `, C" I/ t/ @! Vvar marqueewidth=300
7 Q9 t, a' O+ Q2 ?  H& n//高度
! H5 `5 a  t" j4 T* rvar marqueeheight=25
3 N, Z& y/ `8 V" x+ [) y//速度(1-10)* z. u7 x" I; |) h* L* V% N6 c2 ~$ N
var marqueespeed=38 m% e7 k6 ~5 m# a+ d
//背景颜色5 M! f9 o5 P0 P% d) G# j
var marqueebgcolor="#FFFFFF"
. I4 B" E, j, v- D  b//是否能暂停 (0=no. 1=yes)?
8 P  t/ x7 g* \4 A  ~" bvar pauseit=1) a( G) ]4 O6 H; {/ _' h

' w6 z$ e: h2 r6 y  o/ h1 u# m//修改显示内容  t" }& r, @3 Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; B9 q' C7 c: a: D6 ^2 e, F
4 v% r, h" R% N# [2 ]  B" T5 ]: ]3 f
////下面不需改变////////////
1 a! j' l# N1 \5 ]5 M6 X0 r  d+ q7 R& a5 k9 n
var copyspeed=marqueespeed
& T7 m- H! e# U1 [. o- z5 R$ s5 Ovar pausespeed=(pauseit==0)? copyspeed: 0
+ Y5 H3 Z2 B# a. u: @& S* @var iedom=document.all||document.getElementById
" k, ?" r) ?6 Cif (iedom), v. _8 r- {. C1 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 P* `, w. N5 c: E$ p: o2 T
var actualwidth=''9 ]4 o3 J. G* q+ x8 g
var cross_marquee, ns_marquee
: q- I" W3 P  d+ m8 E- w' b9 ^8 Q; S
3 ^" I' n* b6 v+ J9 Mfunction populate(){* u3 t4 B8 I/ S
if (iedom){2 ^: V* g2 P" R* Q2 w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% K/ S; }, C% U' E( U* e
cross_marquee.style.left=marqueewidth+8; J7 C( V" d. f- i+ ?1 r
cross_marquee.innerHTML=marqueecontent
1 j# T/ x& M+ G  ]5 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) Q+ w8 Y/ m8 V  X- ?: j}
; j0 q( n0 J: i1 v2 g) @1 |2 Celse if (document.layers){
5 P- Z( c+ {( ?# h5 C3 t9 Ins_marquee=document.ns_marquee.document.ns_marquee2
$ s, s( t: q2 {4 a$ _& Sns_marquee.left=marqueewidth+8
- r* m! h6 O' M2 Uns_marquee.document.write(marqueecontent); g6 }9 r' q2 M" V3 q2 O# A( n
ns_marquee.document.close()
# |7 q. c" K" |4 ?4 ractualwidth=ns_marquee.document.width' C0 s. m* t$ e7 \! u
}
- E1 T8 A: r9 d+ xlefttime=setInterval("scrollmarquee()",20)
6 B9 M& z; q! ?5 P. p}. j- q, D1 S+ d( o7 K! H/ s6 w
window.onload=populate+ Z9 E7 q) ?* R' v8 U! K* P/ Q+ U

4 b% E+ _3 h1 e% u; l9 Q4 Y+ rfunction scrollmarquee(){
9 i4 Q$ p! \& Fif (iedom){
! m2 T- I/ ]( U8 v% Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 n+ ^: m' P0 _% G7 Q8 Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: s( u0 e+ _) [- ?/ welse% z5 J4 s/ h! l' }4 x) s( B
cross_marquee.style.left=marqueewidth+8
, ~2 W  ~3 w, [* _0 E% ^3 G  V
6 R' V. r. f7 o& l% [}
  @* |4 m* Z; _7 Yelse if (document.layers){: Y4 P$ G, m) t* P! h% D* d
if (ns_marquee.left>(actualwidth*(-1)+8))% Y9 L' _, j$ X* i$ \
ns_marquee.left-=copyspeed' _: z! Y' W/ U) k
else; }& I1 e  Q6 S9 S! f
ns_marquee.left=marqueewidth+8
/ B( |) w) D& l* i' G& ~4 `}
1 x. v7 i( D& p}8 v# }3 [" t+ Z7 c
) v- y" a/ F. q5 D; L2 u/ B7 g: b, g
if (iedom||document.layers){" P. u& W5 R0 ^
with (document){- }+ `4 N' ~  _3 }# l% w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" U/ N+ o4 L: V& ^  D) qif (iedom){
) g5 r" F- K0 I! T0 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- J/ o' o% e. C8 V: \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) O8 v1 G8 x6 j: P1 @2 fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 Q% G( W& t2 h5 Wwrite('</div>')( L2 F1 U  s8 E6 B
}
6 L( V2 I5 p* }/ t! gelse if (document.layers){
4 x! `$ g: _0 Q, Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% N5 `2 C  C1 K' W" ]+ f5 |- N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ Z2 O# k1 G. f% I2 d+ [
write('</ilayer>')( {/ `* X9 p1 A0 {2 K4 V+ r
}
0 W1 {7 a: y' }& |$ jdocument.write('</td></table>')0 P7 ]" v8 N& Z* R' R% Z
}+ `2 o" b6 a8 K/ G  n7 S4 T1 k% S0 `
}  k1 X* N4 e6 U+ e7 A9 V3 d
</script>

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