返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 `) U3 j# @4 j1 u/ b
var marqueewidth=300
/ X" J1 W8 _. \3 B2 @//高度, x; ^' B" J7 j9 f0 v; X+ w( I6 _
var marqueeheight=25
$ X% e+ A# S6 w6 C# j//速度(1-10)
* f8 b' A# w: h' Mvar marqueespeed=3/ i6 b, S1 f  t
//背景颜色
/ t  `5 N, d, e) I8 `. ?2 \var marqueebgcolor="#FFFFFF"
+ [& W0 F' C; S. Z' O* d7 z5 B//是否能暂停 (0=no. 1=yes)?0 ]  j0 a% i! Z) Q( ^0 P6 a% m  y
var pauseit=1# J# u4 y2 R$ @1 B7 G

/ @2 P! O! I3 a2 Y' \, x//修改显示内容$ x+ i3 z4 K+ [* ^3 ?# A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 V& z, J  b  \  z

' @) w9 ~$ i" B( ?* W
& E( f. {! }. B: S5 V////下面不需改变////////////
, f3 G5 M) S2 j0 h" f. l! Y
6 J3 R  R/ U/ h- ^( f2 o7 D8 Jvar copyspeed=marqueespeed( x% j' ?: s5 E" s# x/ |/ |/ W, y$ l
var pausespeed=(pauseit==0)? copyspeed: 0! D6 }! [, ]5 I
var iedom=document.all||document.getElementById# q" o1 h. B( |, v
if (iedom)" x5 n$ ?2 L+ ?4 `, B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" F. D6 D& C( i# evar actualwidth=''; d: a) C! v. O5 v2 k
var cross_marquee, ns_marquee
  g0 t0 X& n: o% t& b+ l. W9 J0 c! `" k( A- |" B$ {: z
function populate(){2 M* O* ]+ g+ ?
if (iedom){
9 u9 }5 r* F% c; @. v( v3 ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! P; W9 c( @2 b+ u4 Q3 f3 _+ [& V
cross_marquee.style.left=marqueewidth+8$ w0 F* v$ O6 h6 I$ ?3 _9 Q. U$ J
cross_marquee.innerHTML=marqueecontent
4 ~0 G, H. [/ c, T# l+ Q( Q# Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" {1 W$ [# L) X0 ]' L( k  ?' {7 \+ O
}; T4 A; A* K0 ^5 ?1 z" M
else if (document.layers){! ~9 r) F& g4 a. q
ns_marquee=document.ns_marquee.document.ns_marquee2! S1 L" b  d: r0 I; y
ns_marquee.left=marqueewidth+8
, C# h6 G' n( Pns_marquee.document.write(marqueecontent)
$ L! i: T2 G5 u5 q$ t; Wns_marquee.document.close()- N* d* k- J. U8 L0 W
actualwidth=ns_marquee.document.width5 P" @* t9 G. Z% q$ R/ I: x9 m
}( u5 k* w% J. |7 r
lefttime=setInterval("scrollmarquee()",20)
. u+ M6 {5 Q9 u% G" e}! B2 q" }& I/ F% M3 Q6 E
window.onload=populate
) z/ }+ e7 J* }8 B0 Q( S- O' D' _  @. d$ F8 q5 |; Q
function scrollmarquee(){/ }+ v6 I  M& _6 d
if (iedom){
/ [- C/ g4 ?1 R- K, a& A3 z/ Q! n/ Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% i# p2 {- {' ~8 u$ @/ L7 n3 C- b! U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ `$ W+ j9 k3 L9 c  I# @2 H/ {
else
! v2 a1 L% m4 p9 f! e. h+ Ecross_marquee.style.left=marqueewidth+8. j+ K! |, W' y+ y$ x7 p9 G

/ |" w9 r0 i7 B  |3 |2 h9 e}
' T4 e4 o' d1 y+ E8 Selse if (document.layers){) ]& m# _0 U: D8 @6 T, k# c
if (ns_marquee.left>(actualwidth*(-1)+8))
, j1 y: j/ g: Zns_marquee.left-=copyspeed
1 I, w0 x& X4 K1 ?- p' Zelse
4 s: X, U1 Q( Q3 [ns_marquee.left=marqueewidth+8
: ~; s) I9 L' |) J- G$ t}7 }, D  W! ^5 Q" O" u: U
}' I+ u6 V# x$ q
3 ^" T% v$ x  i9 z/ k  D* X! y
if (iedom||document.layers){
6 r. x; Q% r. Y( b5 U& g* ywith (document){
( |$ K3 W7 l3 ^) K: }7 e! e; g1 bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 s1 D  u) ~# R( d2 Q) l& g+ G( d
if (iedom){7 r/ R& c- |" L6 r! ^, @* p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), n' x4 v$ ?( Q7 L" z; c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& b. S1 g+ S/ U: }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); u6 L6 l7 @7 u1 x+ E. {- k
write('</div>')0 f* H7 j. M% n. m1 D0 u+ Q
}
( P; ]+ {0 m" g9 ]+ ^3 delse if (document.layers){3 C2 p: ^" `* J- M! s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  b; F  T7 S; H# m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 j' {: e6 p" G3 V. qwrite('</ilayer>')" E' Y4 k* l8 T/ J7 p8 G- A
}; A/ v( l8 p  x7 C
document.write('</td></table>')1 T8 s4 @: T) J4 G0 h8 [
}
" C7 u6 p; @4 C1 J}
5 w2 @. C8 r0 X0 }& ?' H</script>

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