返回列表 发帖

网页之跑马灯文字特效

//修改宽度: f  I4 J3 P& o+ `4 ?
var marqueewidth=3002 B, I4 m/ }3 t' ]5 ?
//高度- m3 o3 r- o- P4 W% r$ [; ?% M1 d
var marqueeheight=259 b* a; U3 V. P, i
//速度(1-10)3 j, ^8 t! P1 I  r" ?
var marqueespeed=3: `( C4 p. k+ o' M: }6 B* n* Z. I
//背景颜色
/ J# H6 C; M! W3 Z3 Hvar marqueebgcolor="#FFFFFF"$ c$ F8 Y' H- }, Y. `7 M
//是否能暂停 (0=no. 1=yes)?0 z; e, N# u8 F$ i  K9 g$ |! }  s
var pauseit=1. D5 E. ^" I3 T7 ~8 H6 J+ U% ?
% {! Z# u. T- Q9 V
//修改显示内容8 E$ X! d6 Z& X; r( K& L6 S& h4 }/ J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. I) k8 w/ K3 E4 E$ l7 U# g) e
% x3 [- \. s: z1 |/ t: h# y' ~( ~* A$ ^
1 O  g1 Q7 n$ W+ m2 {+ N
////下面不需改变////////////
9 `+ ~; e, S8 R, a2 J+ p
3 f9 p6 U% m! }' b5 u9 x, n: Dvar copyspeed=marqueespeed: z+ W' C  Z' o
var pausespeed=(pauseit==0)? copyspeed: 04 X# b. u3 b% G* z) q
var iedom=document.all||document.getElementById
; u+ X5 |  Q3 T2 K0 Dif (iedom)
8 b  Q: E+ q+ q" C& odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) Q& h9 _+ ~5 G# y4 r0 Wvar actualwidth=''. D0 p3 a+ g8 R
var cross_marquee, ns_marquee2 l8 Z6 o  J. J% C- D- O% g2 X

$ K% R0 m+ Z2 U" L2 Ufunction populate(){
9 T5 P; ]- m: D! F0 U& t6 t8 D) ^6 gif (iedom){
" g9 f! e9 r. O  b8 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 H0 ~& r& V( V; ?- p% q. I; r2 h
cross_marquee.style.left=marqueewidth+8
7 x1 A# c  e* F+ w* W0 J. U) u, Hcross_marquee.innerHTML=marqueecontent( ]1 u0 M- c$ B8 i/ j& L' r
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 a# l- H7 Z6 j" X& L}; ]; p" u& M* C% ?: ]& S# g. ?2 ~
else if (document.layers){% v" M! p6 D( Z/ [) o
ns_marquee=document.ns_marquee.document.ns_marquee2  [! S9 c  K7 ~7 N& R
ns_marquee.left=marqueewidth+8
* W, h4 B9 o5 N: p. Hns_marquee.document.write(marqueecontent)
2 K' B& z8 K- r9 q; w) _, ~2 ]ns_marquee.document.close()
3 _" }! H$ D/ V+ \actualwidth=ns_marquee.document.width
9 J6 M: ^, j( P}, Z. O/ N2 K0 N6 m1 b- r! w
lefttime=setInterval("scrollmarquee()",20)
* ?1 i' k5 N4 z: V& ?* B}# a: [. o  ?0 K( O) M: y
window.onload=populate: C2 m( }! l' C; _
- `* l  X: ]/ P; _  q3 U& }
function scrollmarquee(){
+ K% F1 h3 D# I& Eif (iedom){1 \1 C' ]) F0 }& b7 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, j- c) s# h4 z2 p% _9 n" A; mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- u* C+ j  r- r) Oelse- }+ o0 f2 a4 w% t
cross_marquee.style.left=marqueewidth+8: t- a2 ~1 N& K4 ]9 L  O  ~
) M+ f1 \" Q+ ?  J
}
1 y0 D  O& G1 u. r, P8 Telse if (document.layers){
; P' ]' [) t: h  aif (ns_marquee.left>(actualwidth*(-1)+8))
: y: ?7 ]) i" Q1 c0 R4 b: fns_marquee.left-=copyspeed9 b5 V6 ]6 G/ _7 R' _& I
else" l0 s# c4 _. k$ Y& `
ns_marquee.left=marqueewidth+8$ m1 n- `1 _0 e4 m& _
}. `" l" f+ z/ ], J- ^7 l$ ?
}, d& S3 ~' s# Q
5 N8 e  n. |$ E  a6 {* e$ M8 w& L
if (iedom||document.layers){3 E$ @* w; m$ Y5 p
with (document){
4 W+ h$ @( n2 ^/ Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ R) i3 a! u7 v5 O  c9 d+ J: j% ^8 g
if (iedom){  t3 i8 j5 F$ @' c+ W% W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' k* s9 q: ?( a) |- c) B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  [% A$ h" M6 Q) d- D  Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 w- g+ E6 O& ]write('</div>')* ?; H# F- [& |; u
}. k1 e: c4 B/ ^* ]9 H3 E, h) X' R
else if (document.layers){1 Y& X2 }1 A: z! u+ _( @. v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 G; O$ r' C3 r2 C3 Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) @( W0 E/ f9 A  ?8 I! u. {
write('</ilayer>'); u  W6 P9 L4 n" {! h, K- I
}
/ [. r1 a7 `# odocument.write('</td></table>')
8 L3 y8 R1 `$ ?9 K% q& y}9 o8 m+ Y$ {" ]
}) Z! g- s# S7 t* I$ o4 s
</script>

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