返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 E- f( j& d( j
var marqueewidth=300
: i5 z- k$ G/ I+ c//高度- {& c6 @7 e' x' d
var marqueeheight=25
. G% W' t" o$ A//速度(1-10)7 k) l+ P3 C( {9 v
var marqueespeed=3
6 u1 ^6 q' y8 a; q' t//背景颜色
8 S& h6 F$ ]" m2 w# m+ qvar marqueebgcolor="#FFFFFF"/ z5 x% N1 G; C! _
//是否能暂停 (0=no. 1=yes)?
+ ^0 D" ?' A* c* W  i6 kvar pauseit=1
2 Z4 l2 {$ {2 G+ l6 y
: y" i. `( r# ]% `  a1 |//修改显示内容
5 ?7 L7 E2 L9 b4 e) e8 @2 g4 ~! Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  Y' B# Q( E. m6 S& L) V
- Z3 l3 [( z/ f) b% f" c

: d  i9 f( M8 Q2 T# Y/ a7 O" t$ k, N8 e////下面不需改变////////////
1 r) y  V- C( o+ n, G
8 O- F3 i- p3 @8 V$ j8 ]+ Nvar copyspeed=marqueespeed
( l0 o# n% p# J) y+ Evar pausespeed=(pauseit==0)? copyspeed: 0
9 B: x2 B" w7 Yvar iedom=document.all||document.getElementById& C8 w) {. w8 z1 S* A8 Y+ @& o: k
if (iedom)
& `* n3 u3 [, k) K5 F% @& J! G# Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 v% _3 I' I" y9 V5 ~var actualwidth=''
8 ]3 N" Q) i6 A+ S7 ^" Mvar cross_marquee, ns_marquee
: V: z: k1 I$ `" r9 ^" l5 G* E; M1 G" x; W; a8 e6 @1 K0 X
function populate(){" [0 `- T9 M4 a( f/ t# r" d1 n
if (iedom){8 K8 l9 \; {3 C2 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 a  }# ]) ~$ B
cross_marquee.style.left=marqueewidth+8
. ]; N. f' x# p: v3 t% }$ A! Z9 kcross_marquee.innerHTML=marqueecontent
) e5 M. w; d( K5 Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  _5 n0 X0 u  z, j4 J# e
}$ |- [! i1 ]: X
else if (document.layers){
3 ^2 M0 B4 V, h# ?0 A  C4 o) Yns_marquee=document.ns_marquee.document.ns_marquee2
# ~5 j  f' p4 c2 G5 g% rns_marquee.left=marqueewidth+8$ \# v8 M- d, K* S8 |) F
ns_marquee.document.write(marqueecontent)' d+ G# m* O1 t
ns_marquee.document.close()4 u* c5 Y! h" v4 f( A
actualwidth=ns_marquee.document.width- w' L- i  x5 X* G9 W; s
}% U! d* _# V4 Q
lefttime=setInterval("scrollmarquee()",20)0 e3 ^& G) b8 n2 {/ z
}3 q$ u% b. B- G
window.onload=populate
, ^( T) {3 ]( K% }
* \) y7 i6 l$ C" @- S0 kfunction scrollmarquee(){
7 w0 `- ^8 _4 A9 T4 X& `if (iedom){3 q5 d, W; B. {/ f; j# }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# _  c) U( N6 S3 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) c# j5 K1 B- g' p, Z! @1 l. nelse
/ Y' b5 m' _, C' {  S1 Ucross_marquee.style.left=marqueewidth+8
/ X8 r0 ~2 r% i& e2 {* u7 p, M9 ~0 \  |8 W
}6 O1 {4 h! }) u. v/ y
else if (document.layers){, H4 p1 N1 N! W  O
if (ns_marquee.left>(actualwidth*(-1)+8)), H; z2 j" v3 Z, E6 E( `- h3 U' t
ns_marquee.left-=copyspeed* V! n( Y. K2 g6 {
else7 I. R+ \" \: w; }2 g
ns_marquee.left=marqueewidth+8- y, k, z" j7 C0 k8 c
}
2 E+ k' C1 T) L! w% y5 N}# P/ b+ p# u8 [# G
+ f- n) b; a+ r. S9 Z$ G4 J
if (iedom||document.layers){' ^0 E3 _  d, p* R
with (document){
, R; Y7 ]( `5 R- R  n$ g  {& ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 \4 I, Q( R9 S6 N( q
if (iedom){
1 o6 I; L8 [. _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) j' ]4 h( k" |; f! r4 }  p5 k, ]6 |4 [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 i. w. o6 {1 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ Y+ s% ?0 A7 b: U: ?) y- Pwrite('</div>')
6 X4 U' w) z% C# m/ T}' Q- }2 A7 f4 A/ x9 m# D4 `" {
else if (document.layers){
  @! Y! x5 R1 N& q( e2 b( n; fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 R; K0 y, o( i1 Q( i3 r, O7 H! [* E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ c$ u* R1 T  T& x" n6 S: l; g1 r+ s
write('</ilayer>')6 i* E4 g) n, |7 G( J6 _9 }
}
/ g3 p, v7 e7 hdocument.write('</td></table>')9 i; S) ^4 _, r$ N3 D( i1 W* i( {- e
}6 x2 H" Z1 n; h
}; ?7 k5 n) b) V
</script>

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