返回列表 发帖

网页之跑马灯文字特效

//修改宽度& [  d: B1 v9 E. \/ z1 D* ~- Q
var marqueewidth=3005 @* p. z% B6 q. Z! B1 k* `
//高度: A0 ~) W( v+ Z# b- W
var marqueeheight=25
. V( U. H$ D, R6 g//速度(1-10)
" u: \8 H- `) Z6 F- P6 p; x: ~var marqueespeed=3' E, q; H' I% [" e" h7 f3 l9 D; N
//背景颜色
* t( J" K( ?' x; n% ]var marqueebgcolor="#FFFFFF"
' w3 B/ A5 D9 Y4 s! {//是否能暂停 (0=no. 1=yes)?
. @  O: u. E1 s8 z# b7 ^var pauseit=1
2 Y/ b0 o9 s/ O8 O, G
1 r! W1 [/ W/ e& G& i4 ~//修改显示内容
/ F) X! X+ p2 e% nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 T; M' x' `: j0 c7 q7 o4 B9 q
0 Z1 P3 d6 k4 _) U4 D

: C+ I& D! D+ i! _# D2 o2 P4 }////下面不需改变////////////
1 s3 g$ U, g. l& m8 u
7 O$ a0 _1 z9 k( o! Q. x+ B/ Cvar copyspeed=marqueespeed6 R" t' h% a1 ?; V% ^
var pausespeed=(pauseit==0)? copyspeed: 0
& W; ]. n% {! D5 c% }var iedom=document.all||document.getElementById
) C  c8 U$ T# xif (iedom)* e5 I" c# _- D2 o& U% Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 h  l7 T3 }, x& vvar actualwidth=''6 z0 S* O! w, I6 U6 \
var cross_marquee, ns_marquee
9 N4 b' O( S/ J* Y. h1 c  T8 Q# `, _! E
function populate(){  ^7 I7 ]& a6 u7 N  e7 V+ Q
if (iedom){2 h8 W9 F, {. S/ {; ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( {) Z8 h  r2 h) t0 h1 Z( ?# {
cross_marquee.style.left=marqueewidth+8
7 X, c4 t; X" o/ q/ |cross_marquee.innerHTML=marqueecontent! l( j  y- `% u' I; z+ U. D+ |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( M8 {. o1 _5 k) R% C0 G( E3 W}
7 h2 p* f' n& m: Jelse if (document.layers){1 |9 p2 B7 t6 T3 D% s
ns_marquee=document.ns_marquee.document.ns_marquee21 t& s( C$ W$ J2 r. e' a) [- d; G
ns_marquee.left=marqueewidth+8
* C# U2 G; t" E" O% X2 bns_marquee.document.write(marqueecontent)& C1 c  ^3 V0 ^: [& u8 ^& N
ns_marquee.document.close()0 r. \5 q1 t( l# Z
actualwidth=ns_marquee.document.width
; g2 B7 [+ o& D2 m5 U}( r* w4 Z' I% p* c7 E% J
lefttime=setInterval("scrollmarquee()",20)
" W, }1 O8 h. G- T9 c  L* e}
- Z2 g! r0 H7 N9 Y. Rwindow.onload=populate
/ ^1 O6 G3 s! I
; W$ P# B( L% l' `+ _8 Zfunction scrollmarquee(){
$ j' {7 |* c, Y6 a9 |) ~if (iedom){8 R$ r- }9 m1 g' Z$ Z) E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' w% O9 |& w; ~+ S$ V' m1 x1 p: x1 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& c+ }- z' [% J! p/ T' O
else" d2 O4 Z$ K5 u. [8 H7 W# {
cross_marquee.style.left=marqueewidth+8
! A. Z1 U7 Z' Y& y7 e  v* e+ o
}* d- s5 F8 o2 _: @
else if (document.layers){% {  z/ I& k- S$ P$ F
if (ns_marquee.left>(actualwidth*(-1)+8))
9 ?( ^# f7 L6 F; ]ns_marquee.left-=copyspeed
" k% O2 v7 a+ P& }& ]. p! b% W4 g- v0 jelse  d  y* D% i* i2 s
ns_marquee.left=marqueewidth+8
/ @( h7 k- _7 n, ~}$ v) ~4 |/ L6 W  i
}
3 g& A, g& j  ~; v0 Z/ L- q5 Z
% `' V! c; u+ q. v; n9 rif (iedom||document.layers){# o7 {9 k3 \) N9 z! n% x4 b
with (document){. L, w  H9 C: _) s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 L8 }  ^& U( G" e2 u: N# {4 R; U, z! Kif (iedom){
8 f4 u% i7 y8 i" h. Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, T+ Z, [( x6 \+ Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 Q1 j2 ~" O+ E. c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) T& |3 \% _, c& M* X( `, `
write('</div>'). }" _3 p. C, c" x3 i* r9 J
}
! ^/ Y, v1 {3 z5 u$ xelse if (document.layers){; d. Y/ k8 v$ }' O" r( w9 B; \& f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% W* D8 S0 `1 X& F9 L8 Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 p. l& ]$ P- e( @6 Twrite('</ilayer>')) v% `' G1 m# d7 ~  U$ n1 ^! f. ^& D. o
}% }7 w1 m9 y+ P7 L' d! }1 @; Q' J
document.write('</td></table>')
; q+ i9 g: ?, \% \1 ?7 p& A}9 P' I9 h& F9 B$ v/ \  @
}
6 h- {+ J: K0 X</script>

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