返回列表 发帖

网页之跑马灯文字特效

//修改宽度% t; G* v! f# }
var marqueewidth=300: y/ W3 t4 F- f( q0 o
//高度& ~% q% H3 `7 x) B$ H0 X
var marqueeheight=25
# J7 _& R4 A! `//速度(1-10)
- `' V4 m/ D" ?- H" l' |var marqueespeed=3; o5 k5 ?; Q* F  Y
//背景颜色  V- Q; y0 b7 r# M& W- ~
var marqueebgcolor="#FFFFFF"
, @% L) p- M9 i9 }* d//是否能暂停 (0=no. 1=yes)?
& I3 @$ X% }  y6 I2 w& V6 {9 L5 Xvar pauseit=1
1 n+ p/ i' P  {1 A1 M  _) }+ [! W3 g% c* M* J0 ]& q% j
//修改显示内容* C" [' r  V: [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 E( }& l; A0 T2 Z

& \, V9 }7 ^3 a. h8 V
1 D% z' q, h5 A, g  v& `////下面不需改变////////////
6 C- }3 ]- |/ k6 e* w* r9 [
$ W1 o  p; g! Z8 Z. ^: Bvar copyspeed=marqueespeed
4 k7 z0 T9 u, N$ a' l/ _var pausespeed=(pauseit==0)? copyspeed: 00 U% I: {& f) q5 F7 U* N
var iedom=document.all||document.getElementById) w4 d5 }( a7 h- r# a1 N
if (iedom)
. k# a- W6 A0 b' O* [) J; |; Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 l7 E+ F! ~3 r8 w! ?; T
var actualwidth=''
( _  D. g8 p' E9 N6 Cvar cross_marquee, ns_marquee3 d! A* `) s" N/ S1 H5 X7 n
( b  w& O+ x, `8 j2 b) C
function populate(){
9 ?% q: L: Y1 G& K' y9 r5 U. Q8 dif (iedom){
8 E+ B* C3 U% \/ [. Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 U( N- }1 m5 A: ^& f6 _" l' |
cross_marquee.style.left=marqueewidth+8
4 b) j1 S/ A* rcross_marquee.innerHTML=marqueecontent* k) b4 {0 d% q0 O4 q& c; v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" u2 b- v7 U  U* x! o, `8 v
}* ?' k, |$ e/ Y: O
else if (document.layers){
1 G+ _  P$ H7 T. p) rns_marquee=document.ns_marquee.document.ns_marquee2% Y0 O7 A; `. I
ns_marquee.left=marqueewidth+8
4 G2 C+ k( ^' Q# Y- z" tns_marquee.document.write(marqueecontent)
3 ^  A. [8 F) @. ans_marquee.document.close()
5 {, b' m  y- G& x' C. Yactualwidth=ns_marquee.document.width
2 D' }/ x/ @9 G4 ]) I2 P}
( y7 J3 Y: z7 Nlefttime=setInterval("scrollmarquee()",20)
$ \  u$ e5 r! M% c# ]}, O) z: X3 |9 ?' P
window.onload=populate- F5 u5 ]+ F% H3 h
0 P1 |6 c6 ~: U* F$ J& f: ^
function scrollmarquee(){4 f* I+ r$ p3 u6 d! _3 }
if (iedom){
$ \# k1 E% z, b. V7 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# n2 C5 b4 u2 G$ y! y  _  i9 s2 h! Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ Z9 ^5 z4 R0 p) B; }
else, `+ z) F+ h* z2 r( W  X
cross_marquee.style.left=marqueewidth+8
4 _. o; M5 r4 z4 `" ?1 p3 D# x* v3 U6 A
}! U, f6 G; f8 Y. p  k  p
else if (document.layers){
  w6 c+ g6 U" l5 W, uif (ns_marquee.left>(actualwidth*(-1)+8))8 e  `7 g) F. j2 d# N7 n% N) O
ns_marquee.left-=copyspeed
0 }) O* n; N1 ?8 xelse
* z: b; B- x1 _' f0 a4 Ons_marquee.left=marqueewidth+8
0 O2 Z+ n% ]% q6 }% |7 h}3 ?/ K& ~( G" V& c) N
}
  G% I1 k7 Y8 v) Q* m. V% p# {2 ?! i4 y, F. x8 p$ x& l
if (iedom||document.layers){
8 t$ X5 |) H4 |. T! h% |( v, rwith (document){- X" n# P) j4 c( {6 t; ^* x$ W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 ?- a+ r4 ~3 }' Kif (iedom){
3 t. \" y, C" k+ Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 e: S, f" W" Y) l% S8 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 a7 c! _# M1 v+ }- g6 Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ l  {* }/ K. j
write('</div>')
2 S: o! ~- n; C: F4 \1 E2 U% {}
# Z( l! {4 G7 h. w# P# s) selse if (document.layers){
) z, H' h& O0 M1 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* @) j+ e- O/ o; a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ a1 I' U" h4 b! l1 |
write('</ilayer>')
1 m5 o1 z, I' y  Y! I" O}& s; `! }8 \# @) L+ I; P7 m! r% r
document.write('</td></table>')
( c6 j4 c/ {7 q2 w0 g3 t/ L+ c, _}, i1 r5 o- v; m2 \: G
}' w  P# f7 }4 y* w
</script>

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