返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# G, H1 g. |3 x* d$ S9 H+ yvar marqueewidth=300! W6 X  B6 ?, Y- l2 S
//高度
: E/ Z0 I/ Q3 R4 w" ?5 nvar marqueeheight=25  e- w$ v5 H% }& c. X
//速度(1-10)
7 `% i" F! A% @4 Q3 _, T5 l# g- Tvar marqueespeed=3
  T& ]' H/ m8 T/ J//背景颜色3 I0 C! T9 U+ z% ^/ j& I# M
var marqueebgcolor="#FFFFFF"
/ i! }$ R% p4 ?9 t8 }( |7 j//是否能暂停 (0=no. 1=yes)?
2 ?% k. F' h" v+ dvar pauseit=1
$ b+ a0 ], C$ W& w9 k* I
% O  |+ W$ f8 j3 _+ I8 ?//修改显示内容
2 C$ M* A: `, T5 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 a: b8 X; |" ~% h1 D# u1 H. |) S5 C+ b

( w* @. g! K: L2 e/ @$ I1 l" C////下面不需改变////////////
6 R$ f5 F) E  N5 H  x6 j. ~: P* p; s5 [+ ~; f/ l: h! S
var copyspeed=marqueespeed
. O1 P" c5 Y  R0 \7 Jvar pausespeed=(pauseit==0)? copyspeed: 0$ m! k! o0 x1 F% Y
var iedom=document.all||document.getElementById: r) L, o+ C* E, p2 M. M: y0 `
if (iedom)
/ w# o" E  t- x2 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 `  ]: l( r* I1 l# X- e7 d
var actualwidth=''
5 L# }5 v) s/ ^7 E+ Rvar cross_marquee, ns_marquee" y6 f( @' y. ?# `# _( i# v# i! T
8 d3 p0 E) h3 m1 I
function populate(){
  ?1 Y7 ?4 a0 w; Dif (iedom){; e. @' Y& g4 T2 E; Z0 `3 a4 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* {- h6 o0 v% n$ \/ n$ o
cross_marquee.style.left=marqueewidth+8
! J( s) r. M2 {4 zcross_marquee.innerHTML=marqueecontent3 k4 R; A) O: E) s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ w. D* v+ N- T" ~1 o" d2 c. W0 N}
: ]: A. s+ N8 {3 n% qelse if (document.layers){
4 S8 _; L! X: G( ~$ W' }1 _ns_marquee=document.ns_marquee.document.ns_marquee2
& o8 m& `" n# r+ wns_marquee.left=marqueewidth+8
, O) g+ v3 K% j7 X, k8 Sns_marquee.document.write(marqueecontent)( A( ?6 _& `8 C  n, F& s$ X8 G
ns_marquee.document.close()
7 f1 x: m! k$ P' o0 Aactualwidth=ns_marquee.document.width
$ w+ @; y/ b2 {! U3 U$ o# E6 j) W}
! K+ C" l/ j$ g% ?7 W4 glefttime=setInterval("scrollmarquee()",20)2 @5 Z  w8 `8 x
}4 R( x% M( T# @1 q7 I
window.onload=populate- k+ B% @5 B1 r' F6 B5 ^
  x( O* D; V; p) w% r- X! ~0 @
function scrollmarquee(){
: Q( c4 |3 q) t; w& C4 Cif (iedom){" ?8 ]$ k& w) W4 i& x) k3 y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* F1 D- ^0 A0 L& v/ v- b" Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ a" C! Y& `+ q% c6 V9 I$ c$ }
else
1 z8 n0 w8 }3 P& L  R: u( Q4 o& ~cross_marquee.style.left=marqueewidth+8# n. t6 @% B3 Q! e2 w' F3 z
1 A' j  l9 t  X4 e8 n! v
}: z8 Y  [; e4 F) D4 {
else if (document.layers){
: v# w* t5 L6 Pif (ns_marquee.left>(actualwidth*(-1)+8))4 C+ I  ~5 G. G
ns_marquee.left-=copyspeed! x% P  Y9 E* J, U3 m
else& [3 Z8 @8 c4 e; A
ns_marquee.left=marqueewidth+8
8 p! D. k0 x/ S( A}) Z; b5 n, g( m0 y
}
/ D6 r' X% l! s( Y! c
1 }! ^( b9 r+ N) Jif (iedom||document.layers){; j$ D  [( n% z! G; _
with (document){  L1 B/ M& {; ]  Q/ c4 y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 b( T5 S. `8 B$ y2 e! Vif (iedom){+ Z# H' m. x5 C% o) R- H7 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 J/ }+ v3 q: w8 i7 d2 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 J/ L5 S1 \1 O9 F$ Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: X8 B+ V/ R, |, `$ Ewrite('</div>')
# h2 F2 t) i! `' B}
8 U5 Y# }* w& ~& Z- felse if (document.layers){! C3 R- c3 v# i/ b& s9 V$ h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! [  i4 ?, j' d$ V; U+ Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- t1 {: C* Q$ M2 ]: awrite('</ilayer>')
- z+ b9 K# {" g}8 v; G* Q( w. r
document.write('</td></table>')
) X$ D# x7 F3 w# w- I' C9 q}5 w  p- J2 v% K9 N5 Z$ v
}
5 J8 P9 |4 D: J( D</script>

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