返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* Z2 m% K" u1 t0 K0 \" n1 C' tvar marqueewidth=300
$ m! s, T" r* d: \//高度& }- G- K6 R. j, t
var marqueeheight=25% T6 a- l6 I  }, n1 G8 P* g
//速度(1-10)
( S9 P- k; p* C" Ivar marqueespeed=3- E( r8 g$ |0 b+ Z" I" P! }
//背景颜色) E7 `, e; z. r& j1 L& ~
var marqueebgcolor="#FFFFFF"2 m5 H/ t% I4 J5 H" f+ E  M
//是否能暂停 (0=no. 1=yes)?
2 X1 m; S' d/ K" i( F% Nvar pauseit=1. `) a( f' U+ A. ], C; g3 z2 F

& ^9 m# s! K( r8 ]2 H. E( F( I& I//修改显示内容
( ?% i& a5 f1 ^4 }4 g* C7 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 L6 f+ i, z7 P+ `0 g9 D5 b' `2 V5 B: K& Y

8 z1 r& n( s( ~& i# ~////下面不需改变////////////5 n2 |3 W1 R7 I/ G8 a
0 F5 \3 n* T/ S" {; K0 ^( v$ L/ z
var copyspeed=marqueespeed
, C! ~3 B  @# ivar pausespeed=(pauseit==0)? copyspeed: 0
7 s/ D' ?6 W+ R0 ]/ Z* U& O3 Qvar iedom=document.all||document.getElementById) c2 g6 E% Z: c
if (iedom)
* F' h9 y/ w. x( z* ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( j+ m1 O$ B2 p# p4 l% V5 n
var actualwidth=''1 j" ~8 q. [; X4 `/ h) {  @, w
var cross_marquee, ns_marquee
. R4 K8 K0 c/ g
* w- h+ u$ `  ~$ s! f$ l8 dfunction populate(){8 A: I8 G6 B" G  A5 L, J4 x
if (iedom){
5 T7 W; {- ?' J: j3 Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' W  b3 _# E- o8 }5 M7 Y
cross_marquee.style.left=marqueewidth+8  u0 ]; X  @. _
cross_marquee.innerHTML=marqueecontent
( y' P8 F# b2 T+ [$ a: j0 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- F. H" H( ^  \9 r}4 k7 j5 P! t1 t# p0 {! Z
else if (document.layers){1 J7 w8 r4 Z9 z' U9 _& m
ns_marquee=document.ns_marquee.document.ns_marquee2
& @- [0 s% p5 Y" @/ o/ r+ mns_marquee.left=marqueewidth+8
+ ~/ ^' @' d  Yns_marquee.document.write(marqueecontent)
, K+ |2 c( a& u1 p% ~! ^! bns_marquee.document.close()2 T6 `- k+ A+ W* B- E0 N
actualwidth=ns_marquee.document.width
/ w( v8 a1 n$ b) ]0 O}4 @) p  [) q# [6 a( O& j  h; h" D
lefttime=setInterval("scrollmarquee()",20)+ x$ I9 h7 w5 X- X( T( U' A
}
" P& n( P1 h4 u+ Dwindow.onload=populate/ Z0 K% t; G" `! `  h

. L* D0 F3 x" xfunction scrollmarquee(){
0 s' h1 k$ o. X: Q& _if (iedom){
$ q/ U8 ^2 C# |4 R' M- l$ S0 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: l; G# n0 @( W: ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 \7 o7 H/ M9 Xelse
4 ]- F9 i  i  Kcross_marquee.style.left=marqueewidth+8
+ s: t7 G& L6 }% O. x& q6 u* m  {- c. v
}0 G: [0 p$ o4 o+ R
else if (document.layers){- i5 q8 A, k" b
if (ns_marquee.left>(actualwidth*(-1)+8))
0 X, Y' c/ x$ |# ^ns_marquee.left-=copyspeed
. L0 s  p; Q- ]( celse
' [  Q# R3 d4 H, S# ]9 n0 zns_marquee.left=marqueewidth+88 q% o$ n- i: P: o
}: l6 {" b1 C- J" W
}
0 Y. @5 d* ]8 T. b! E( a; s! B& d% o+ c' T6 x0 J& W+ h
if (iedom||document.layers){
1 N- g, y, s# awith (document){
$ {5 E3 T6 h1 X* W" j& J0 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: ~/ O% p2 A- d' i- {if (iedom){- U% Z4 s+ z; t( I! P0 U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- Y& v  z& b$ S% d' ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( r7 X/ `, a2 V4 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 O( n8 X- I' \5 U2 F
write('</div>')
+ L" f8 h" W; ^- \3 J}
( ^8 P6 [% s' m5 Y+ [  Helse if (document.layers){
0 x: U5 q. C: L, j  \; a( Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* D# w) l) @% ~$ Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 N- y2 ?; b5 {% L2 c
write('</ilayer>'): v' g; t* |2 `% K
}
: G/ a8 U- e' Pdocument.write('</td></table>')
) D# Q" g+ k4 p9 o}
+ _; P) r5 S6 g8 _5 q}8 V" c8 i7 y, \
</script>

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