返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 b+ t% F4 e2 J
var marqueewidth=3007 A) M; G2 |+ d, S8 U
//高度
/ |4 S  h' W# l: J# Wvar marqueeheight=25
0 ^% i  q3 Q/ I( a( }3 O//速度(1-10)
: }6 k% ^% z. w6 p: o7 ^& C* c, q! Fvar marqueespeed=3
5 V9 z; H" ]+ Q) t0 c//背景颜色, P& ]9 `' n  Z/ ?' ~* d3 K
var marqueebgcolor="#FFFFFF"
* C+ n# a# K" K9 p; j0 {//是否能暂停 (0=no. 1=yes)?8 f1 ~2 C: \9 k% h" y
var pauseit=10 u" c* j5 n! A. r2 q) }* U

- y$ g' {, M: M8 N" F! Y* ^/ d# r//修改显示内容% }' h4 M7 q$ d! v% A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 A$ ?; t8 ~; i3 V& m9 Z8 ~$ Z* _" p2 |; _/ ^: \
* u9 X, @( ~" h) C
////下面不需改变////////////" L: I2 b! t4 R1 ^, l% g
& l) i- G) n5 `7 z/ ]- b7 X
var copyspeed=marqueespeed+ Y- S# b9 z# `
var pausespeed=(pauseit==0)? copyspeed: 0) b4 X: X; s, E, B. v1 H
var iedom=document.all||document.getElementById
1 X2 J" t1 E1 z5 N* I+ c- c" aif (iedom)( c1 C  ^: J+ }) W. @( O2 B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 @  N+ k* [' ?. F5 H/ a) qvar actualwidth=''
( h5 L# |6 X' T# [var cross_marquee, ns_marquee
5 i6 @- t: R& ?
6 H7 V5 n" O1 t, N; i/ L9 ]function populate(){8 [4 h/ x4 t) |, r! Z
if (iedom){
) G, p* e' r$ i! v( F; u8 |- X. ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# m7 f) Z+ t5 u
cross_marquee.style.left=marqueewidth+8
/ ?4 A. I! N% [" L$ Hcross_marquee.innerHTML=marqueecontent
4 e/ t; z& l' J) q( V7 t9 ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! G) y- X; p- Y$ W: V
}# t2 b% n' A1 O. i
else if (document.layers){
) m3 [5 i& s7 r4 d( R. n. n/ vns_marquee=document.ns_marquee.document.ns_marquee22 C% G$ D; C) M/ b$ ^/ G; q
ns_marquee.left=marqueewidth+8
: B% R7 F) i1 Ins_marquee.document.write(marqueecontent); Q, f1 Z1 s  K; [6 g. x
ns_marquee.document.close()
" [) o+ g/ I) N- F! X' a  u4 pactualwidth=ns_marquee.document.width
' ~3 l) U& L* Y6 {) B, H1 s}
6 M" W5 K" D( d8 f6 Llefttime=setInterval("scrollmarquee()",20)
5 I# c" I/ Y3 q+ d( V: d}& r$ J, ]% w3 @7 S9 X
window.onload=populate8 c. w& P, z; H8 @: T  p
# }3 o+ H' J, z  g
function scrollmarquee(){
3 C2 i: B4 M; a) D3 V( vif (iedom){
' F, ?0 D2 Z, n1 c$ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); v! a4 e$ P8 O: U) o8 _" z- s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% ]; M& T' O- ]5 I
else% ^9 {$ h) Q( k- o; o# Z1 y
cross_marquee.style.left=marqueewidth+8/ s9 m/ z2 L$ b- H- \* C! W

4 o! X$ P% S: j  D( P}
( R& I4 _4 D  ]. Pelse if (document.layers){
! V" b2 u" x( b- p6 r$ eif (ns_marquee.left>(actualwidth*(-1)+8))
2 D1 s/ w* Z7 T) gns_marquee.left-=copyspeed
1 _6 `% J9 K7 P) l, a; ^else+ O4 N' r1 |$ V
ns_marquee.left=marqueewidth+8# J6 R2 D, U, K7 m2 l
}7 D# E9 p9 @9 O0 D5 q4 X1 r2 N; i6 \9 e
}5 L- j8 J$ y6 J8 K3 l& x
' O# d" B; V+ Y% }, ^6 L; w+ S' ^' A5 e
if (iedom||document.layers){6 t, \4 Z4 |8 f; u& M( D1 Y
with (document){6 ?4 \' S( C& w. E' k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 ?2 {+ A9 d/ ]if (iedom){
$ b- `& i# `& M. t" Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ J% M( E  B% l: k* S& _+ |+ e4 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& C8 f8 O) Q0 a. Y6 E8 I5 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! O2 }0 O! K+ L7 f0 |8 n- d. x6 j4 x
write('</div>')
+ p# Q% K# p: X) z# g# F}
+ O5 [9 e- H5 n9 o6 O: J3 celse if (document.layers){8 s+ C) |8 S5 a. ^) P3 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 C1 H6 P. u- y$ W, r& awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 G6 p0 r3 K* O5 @/ L  z0 I: Kwrite('</ilayer>')
% u+ V1 B2 E1 N- P1 v6 c# |' O$ \}8 o1 W5 _  [3 |( j# X8 K
document.write('</td></table>')" D. ^' }  Q1 Y- s1 C; [8 X$ O
}) Y( O# W; G0 z! P; Z
}
4 i/ s& T. Q# j" q</script>

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