返回列表 发帖

网页之跑马灯文字特效

//修改宽度: ^3 f# U/ A; S* U8 m& N
var marqueewidth=300
* f* Q' S& I1 W, Q2 A/ G, G( E8 N//高度
6 i3 ]7 c- H" @6 W+ Vvar marqueeheight=250 A& m( }& l. q( q; t* K+ p
//速度(1-10)
$ V; C. `0 m! a! tvar marqueespeed=3
5 W- P5 D- J' N8 `+ _0 F3 N! n//背景颜色
2 \1 w" a  s4 g" @3 d/ ivar marqueebgcolor="#FFFFFF"- m/ F6 c( c8 P! o
//是否能暂停 (0=no. 1=yes)?9 G  T' e3 ?1 j9 N5 Z4 X4 U, ?
var pauseit=1
% |* R( w2 C$ ?2 S1 H  v
  c$ s4 C( s$ G' E//修改显示内容3 }1 O. g9 @2 ~  m7 }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! ]2 z; _' V* a* I1 v! A9 B" c: C
. ^. y- f( |- j, A- Z1 t

* Q5 ^. c6 E6 _( A+ l////下面不需改变////////////7 f! K4 G; I: v

9 E# b' e7 b) ?4 M6 D9 q2 kvar copyspeed=marqueespeed
% Q& b' _: I; Q$ P4 R4 Evar pausespeed=(pauseit==0)? copyspeed: 0
0 Q$ H! p% r* n0 y4 Gvar iedom=document.all||document.getElementById
3 Y; V1 g% e" }if (iedom)
2 p4 T5 ]* n+ o, J! Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( Q' q$ t* Y# c. a1 y' \4 mvar actualwidth=''6 ?9 f; o1 w1 H6 ~* ~. `
var cross_marquee, ns_marquee
9 U# Q" R4 E5 N1 z6 Q0 p+ u: f0 a" }* d
function populate(){0 L/ A+ ^: \/ e
if (iedom){+ F0 z& C+ [8 H0 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' Q0 e: K' e5 [- q3 ~1 D: E! Xcross_marquee.style.left=marqueewidth+8' g% j! |3 J- G- }7 e
cross_marquee.innerHTML=marqueecontent
- }, c, }) q. p; L. U  K9 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) w' k8 u" h. A  ~6 p( h}
, g7 E* [  s! C/ q" \1 qelse if (document.layers){
, n7 ]+ D9 v  c8 h; f" z; ins_marquee=document.ns_marquee.document.ns_marquee2
6 n4 R% N! w, K8 ~" a, B- N9 T, \; ens_marquee.left=marqueewidth+8' Q% [* H( b6 w6 }" p: p
ns_marquee.document.write(marqueecontent)& p/ B7 K9 c8 L* x  b2 s0 r/ f
ns_marquee.document.close()& V% e3 u) N/ J
actualwidth=ns_marquee.document.width2 {8 o4 m; _0 J6 r- N
}
1 L- |" l/ W2 }* n7 ?lefttime=setInterval("scrollmarquee()",20)9 e* P# _" W  I7 C+ I
}7 `& `  |  p6 J" V$ o- x! c& r
window.onload=populate
4 z. K- a- H; s; k  x8 j; b6 }; t4 j
function scrollmarquee(){6 n+ ?; O; _1 u6 y" J) G3 `
if (iedom){
$ r- r  Y. }0 ^) N2 |& Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 V( i7 w* w. A  @! ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 e- C4 x7 p2 b5 g: r% u2 {
else
5 c& W, b+ ^9 s4 j0 H1 v: B- z+ a, Ecross_marquee.style.left=marqueewidth+8
' \3 }# n' v1 L  ^9 ^- {0 i$ r% p& Y7 L2 E
}
* @- u" S1 v& G" s' X* S8 X! O4 xelse if (document.layers){% x  o; U" l. B" l2 x& V
if (ns_marquee.left>(actualwidth*(-1)+8))4 n, s' ^" r3 p( B; s1 ]
ns_marquee.left-=copyspeed' }1 c7 s, b* R7 m% W
else
! K' b1 O, s6 jns_marquee.left=marqueewidth+8
. l/ U  P* m3 b  H8 @! p}8 j' r: D8 h( U: ]
}
5 b4 o  T8 ?: Z, i  \' a/ k
6 O% p5 }) \3 {% qif (iedom||document.layers){4 k; l7 I+ W$ y9 R- F% K& {' G
with (document){
7 \% m% U  h) }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- a6 j: a4 N+ g! p0 U5 |( N2 ~
if (iedom){
# p1 Y2 E; K# e. A* Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; i5 t8 L4 O& @9 j) D+ z0 v2 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 t5 r3 a$ Q" I. q7 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): _1 `. B: g0 V! L$ n7 y; J
write('</div>')
5 R( {  f9 I1 w6 o}- ?  j9 j; W# i5 [
else if (document.layers){+ t9 V' h9 ]2 c1 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% ]5 W8 F7 c7 F0 n; p4 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# v2 U, h6 J% j4 x' U$ Cwrite('</ilayer>')/ ]! Y! j7 A& }
}' G2 \' j& }4 P2 Y0 w8 ?
document.write('</td></table>')
) t( q8 _; I* [# K- f  Z}
+ d. a2 c% M& G8 F1 E}
  |# ?- P' N! o% z5 G0 Z; D  u8 j</script>

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