返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 f: u+ V* N: r% W+ ~  O1 M1 e0 k& Nvar marqueewidth=3005 Z5 r: K; [7 }+ H
//高度: R) t9 D0 y7 m$ P1 ], X
var marqueeheight=256 [7 L  O% j8 [( f1 [4 }  C5 ]
//速度(1-10)) F, Z" K( t% e6 D8 R
var marqueespeed=3
! C1 l+ |! k$ T1 Z$ D3 r//背景颜色) P% X/ c( Z( c$ u$ [- r0 N3 W- D2 K
var marqueebgcolor="#FFFFFF"
# H4 _! c/ Y- ~: m' G//是否能暂停 (0=no. 1=yes)?
+ i! Z  ?6 F- i) Z) d" y5 wvar pauseit=1
1 Y: U6 N0 Q6 a$ N: G
* g5 m' Y0 ^3 t7 E4 g//修改显示内容0 H; I8 K9 ]( ~% v5 `) B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; j% q2 @9 R9 x* ^. t

! l/ i- p$ E3 V& f
8 q& H; `1 N, q8 I$ j6 N////下面不需改变////////////
. R/ L% B5 U9 Y* f3 N* W: G+ `! X7 R! Y) t) Q+ ~3 o
var copyspeed=marqueespeed) s; e- J: C$ i$ Y
var pausespeed=(pauseit==0)? copyspeed: 0
1 E( @& f% U$ I& R: svar iedom=document.all||document.getElementById
" c# n9 ]6 M1 ]& y; j  q6 mif (iedom)
9 J. B+ p8 ~5 L, }/ F  k7 Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 O4 d5 Y5 p1 R. s0 `7 Cvar actualwidth=''2 k9 a) r$ H) T& u
var cross_marquee, ns_marquee
6 O2 E" \6 ?, k8 K* k3 }- @7 s
# ~! ~( ?& D5 Vfunction populate(){7 a3 j$ G" }  A0 _' u( H
if (iedom){4 K: Z% T1 {' C5 p; m0 ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 \% B" M+ L- P, V! z; l$ |9 ]/ w. jcross_marquee.style.left=marqueewidth+83 q, H) S) r$ p/ y: Z
cross_marquee.innerHTML=marqueecontent
( O9 ^; A6 v" c/ {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# o- ~/ m7 C$ @0 l3 b, Z
}
7 F1 B1 g+ d, X; W2 r* }else if (document.layers){! G' u. d( H! E% }& S% N9 n; a
ns_marquee=document.ns_marquee.document.ns_marquee26 q0 Y8 K1 Y& u! o
ns_marquee.left=marqueewidth+8* K  {/ w7 z- a+ Z% o% J& j; x
ns_marquee.document.write(marqueecontent)
5 c1 y, n! v& @! D: xns_marquee.document.close()
0 `. i) h0 F2 F6 h- N: Uactualwidth=ns_marquee.document.width5 X* a2 v% P# V, u' ~
}9 a; I& y& r* R$ T* R; y4 h7 J0 w& a
lefttime=setInterval("scrollmarquee()",20)
8 D) k. U+ n0 |3 U. ~}  H/ t: C" d5 y7 x3 L# C
window.onload=populate
' }+ J1 ?. k4 ~" Y% I+ j  @& w7 p5 t' C# s
function scrollmarquee(){
8 F1 L4 I) S" \0 hif (iedom){( \5 a8 a" {. p* X1 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* S4 c0 r; _2 F2 L- t  ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: t  k4 c' X  ^; N
else5 l9 g4 J& |& q: {) N2 O, d( j
cross_marquee.style.left=marqueewidth+8
, t5 x0 R! d: a) o9 c  i! ?  |7 P9 l! \; @
}. a7 F) D8 _* l# l- X+ P4 i
else if (document.layers){& ?  h% r5 g# w# |5 h6 y) F% Z* c6 ~
if (ns_marquee.left>(actualwidth*(-1)+8))
! }5 k# `) h! t/ y. x% L% Pns_marquee.left-=copyspeed/ r8 \: ^: q; \/ r: ]: ~& V5 w: d
else
# f' h1 b* W( ^4 Xns_marquee.left=marqueewidth+8
& i8 s, K. ]6 l& l}
0 ?% B' p3 n1 A' o: V" Q8 y}# l/ t& m. Q- b8 c* \

% @! F/ p$ Z1 t1 W4 l5 F* ?if (iedom||document.layers){' o- j* S- ~. _" L- \
with (document){
- J" i0 ^  F. B" N! N, a$ X2 B5 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 E5 y# W3 u. W+ v7 g) T
if (iedom){5 i) E8 b9 C1 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# ~" E9 @0 O' S  T' q+ ?, c; Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 \: K1 Y# q& E7 Z' y! A* L( |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 F$ x7 f1 R- H! t4 Rwrite('</div>')
% ^! r' l2 a5 c4 C& n}
: r7 ~2 t5 ^' V5 |$ X; B0 jelse if (document.layers){# S$ l% ]. V7 m( j# S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& Q. d$ {' P+ }; u1 S7 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( O8 }8 i" V+ m" w  Z& F! s
write('</ilayer>')
6 z6 {' D1 @. W* ~}# j" e6 }- j- \: M) `$ V
document.write('</td></table>')1 e; W7 c4 o& I. [; o$ V! Z
}( O) q( o7 |! U
}
% N+ w& d9 L' y. c1 e& {8 ?- }0 L: ?) @</script>

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