返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 i: Y8 N( a) x5 g5 m7 z, ?var marqueewidth=300/ M# ?# m" U* [+ U. D0 R  j- \& Z
//高度
- v& L- r9 y4 C  mvar marqueeheight=259 u4 T' M7 O& F9 e7 I- s
//速度(1-10)
% {& W+ F; E) _# n8 V6 dvar marqueespeed=3
# W2 E) g4 F9 ~//背景颜色
* g* c" ~5 ~$ r, O2 }var marqueebgcolor="#FFFFFF"+ Q+ @  ^5 `2 U
//是否能暂停 (0=no. 1=yes)?! I/ }3 _1 k, [+ e2 c
var pauseit=1
/ g+ J4 ]4 t2 O' d% k5 e
9 i) C' v# S6 S, y+ u- |( V3 L//修改显示内容
- P1 j" U( ~4 dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 ~+ C& [4 v4 W3 q( K  a* J( }2 P; c% u! d

% k8 h; \2 I" ~2 |) q////下面不需改变////////////
- `5 i  R- }0 t. X+ K: c0 X9 u1 @2 k, q. J: u" X% A
var copyspeed=marqueespeed
% [: H0 \8 B0 X, g- G" C7 Ovar pausespeed=(pauseit==0)? copyspeed: 01 B0 F" E1 u. B! ]" a& [! C- k- d
var iedom=document.all||document.getElementById7 w' o/ f" A- t- m. r) W  K
if (iedom)
% T; O2 |  p6 l( l- P; n+ Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); @7 l5 F6 d6 B7 a% T" f% c
var actualwidth=''
7 C+ x5 k3 d# n- s( r# s8 Bvar cross_marquee, ns_marquee
% z7 ^6 K: h  G* g/ j+ q
8 k5 E/ I/ a, h) C' w, {1 E: Jfunction populate(){
' C) p* l: x1 m; r" N) \$ Eif (iedom){( u; j* ]5 s% Q$ F) c* @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; g+ ]+ A, m% e+ n/ y$ K' b( Q
cross_marquee.style.left=marqueewidth+8
3 F2 E) I% n1 F# l% Icross_marquee.innerHTML=marqueecontent" R1 M' v/ ]; m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 f9 B5 `6 L! }+ a3 R4 J
}1 C. L3 P9 _& }. o$ c7 I# h
else if (document.layers){
- G4 d% j7 j5 F% u8 Ens_marquee=document.ns_marquee.document.ns_marquee24 Q+ e+ K3 `, ]5 z$ `$ K! c5 E& C
ns_marquee.left=marqueewidth+8! W9 ]  k4 e! S; D3 q. m4 p
ns_marquee.document.write(marqueecontent)6 J: w* G3 j1 ~0 |+ h* E2 M
ns_marquee.document.close()" ^0 v* w) p$ o& u7 U5 K$ B
actualwidth=ns_marquee.document.width
" |7 o8 }* `; O- j}% D" n( k+ s% D* h: w
lefttime=setInterval("scrollmarquee()",20)
) [) M' n! {) B6 w) Q& ?$ P}
0 ?/ D3 P9 `+ W& \( Owindow.onload=populate8 ]  E) Y' C' t( y% Q# p3 {/ ^, C5 q

) l# d9 Y) Y# t# N. F+ N4 o& ]function scrollmarquee(){
2 `% |% r) r4 ?& h8 {0 N, dif (iedom){1 \& Q4 m$ Z: X# ?8 a$ t/ B; ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) W  F6 y  L! C2 T% z6 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- P4 J3 ~$ d! @; [! |1 o3 xelse
4 p1 X+ L0 s* J% Z! L: E" J1 Mcross_marquee.style.left=marqueewidth+8
* Q# V9 y! M0 A  c
* w- \$ C4 w" o+ Q( u  `" ?/ |}6 ?& |8 u4 ?4 F$ I% P$ r4 F3 W/ b
else if (document.layers){; Z# v* L! R; R8 q& K" i  `
if (ns_marquee.left>(actualwidth*(-1)+8))( Q. F2 o: n/ y/ o; R, k
ns_marquee.left-=copyspeed
. G& C$ ]8 q: X2 ?# `2 ]4 felse
! ]9 R* h7 D5 s/ U2 x4 R$ {ns_marquee.left=marqueewidth+8
1 A# P% Z* @# F6 J8 e}
& m1 F' j3 N9 Q9 l7 e) [0 K% D! B8 a}
( B% o7 z' D- K2 |: m: E
8 e& A8 ?9 y# ?( ?0 x: Lif (iedom||document.layers){
* ]! A& L: K2 Z+ k3 Z: Ewith (document){
- B: b; b$ y% g$ sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 K: {8 M0 v% t
if (iedom){0 W8 Q* c3 k( q  V( s( E* V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  [, {# a& x& bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# }; {* _% b6 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 i' T# c/ w' g& jwrite('</div>')$ L( @, d3 }# l
}
0 w; [% |# t7 ^* V7 X" Belse if (document.layers){
6 w! B) {, D& ?, E$ a/ Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% x+ {4 l+ V$ Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& F  Y# I2 w' G5 \% N# S
write('</ilayer>')
2 f( b# G7 E. k  L7 T}
- t! n& u5 F% R5 {0 k7 c* w) S0 T: N% ]document.write('</td></table>')$ Z. g; n1 y% ^) L
}
! o  j" @) I1 m# d}7 w! y9 n0 M7 w0 n3 D" `  ~$ y
</script>

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