返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 C% Z5 }$ p0 @/ z, M- G2 Jvar marqueewidth=3007 e) {8 ~, W2 N7 h( l
//高度
% z3 ]+ q: d) b+ p9 [var marqueeheight=25- n8 F2 k8 S7 B
//速度(1-10)" Q# ^7 ^) b# R) @
var marqueespeed=3
, E. k2 ]/ ?9 R' k$ Q, d; [8 c6 \2 f//背景颜色- N) k9 s2 H; l9 \' b9 k+ Y
var marqueebgcolor="#FFFFFF"; t& N* l/ {9 q
//是否能暂停 (0=no. 1=yes)?
! d5 \  z+ h$ C* ]0 K5 X* [var pauseit=17 L3 o, A+ N  ]8 w9 i
3 p# f# H/ [: h
//修改显示内容5 U7 K6 b0 f8 h0 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 M. e3 j% f4 F* X

+ Q' Z# U4 N7 j/ @/ N
8 e% i( O9 t4 D////下面不需改变////////////5 X* Q% F3 i& O' J% n2 e$ U/ L0 C
7 V! J! f1 \  G
var copyspeed=marqueespeed4 O5 O! X/ J5 I! C3 Y; q
var pausespeed=(pauseit==0)? copyspeed: 0" B7 ~. D6 B/ y0 B& @
var iedom=document.all||document.getElementById
6 e' v/ K0 p' B) e7 j  M6 Y5 wif (iedom)7 H# p# F; s; O4 [, ?0 P3 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 G: k! D: C+ _var actualwidth=''
: G* o  Q2 u, }5 y' Lvar cross_marquee, ns_marquee
0 w0 V3 {# N! X" z; b- F3 A% E4 ~' z( [% G$ s5 \% K
function populate(){7 T$ Z, U  Q5 l0 b/ ?
if (iedom){; h0 D2 S/ ?! k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 ^( o, I9 C- e" @2 ?1 p
cross_marquee.style.left=marqueewidth+8
: l- r4 B2 Y. ]! Q. a. mcross_marquee.innerHTML=marqueecontent
8 y. I+ s1 P5 i: M# dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" m8 P/ k7 a5 H( E- o% C}: q3 J( g# I1 M/ Q
else if (document.layers){
% @0 x* ~5 N2 y1 C4 Sns_marquee=document.ns_marquee.document.ns_marquee2
% V$ X3 Z$ K5 B. T/ qns_marquee.left=marqueewidth+85 R: [5 Z( v/ f+ V1 D, z9 C
ns_marquee.document.write(marqueecontent): E3 Z7 ^1 w; u- V, L( U
ns_marquee.document.close()! [8 W% f0 r7 w0 c/ A
actualwidth=ns_marquee.document.width! L5 S/ F- g0 v" d; F" e' \
}5 D9 Z$ y# V! g7 h% B
lefttime=setInterval("scrollmarquee()",20)
( O" ?% F$ y# y* R* v; j. C6 P}
6 |  R0 _6 _% L2 V  h0 zwindow.onload=populate
& ?0 T5 @) b. i) R0 C6 t9 C( M" R: u1 X- T
function scrollmarquee(){4 w- j: f, L% V# w  k! l8 k" g
if (iedom){
0 R7 b* q2 u2 }* d" c- T$ O* L! yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): G- q, B/ R. C% Z- K% p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 U1 ~  }! e- ~: \& Lelse6 S- k( X4 L$ e! a! G8 I# ], i. \
cross_marquee.style.left=marqueewidth+8
; l4 t# y4 t: N9 W0 c
( ?4 j/ U4 @' L; l; h# s) h* {}
) j& R6 d" ]' e# telse if (document.layers){
! M8 Y; V$ M, W+ B# \$ N+ E7 eif (ns_marquee.left>(actualwidth*(-1)+8))( v# a# W% @' c, [7 e' f
ns_marquee.left-=copyspeed& i. n, o; O: n2 q( w
else. r' h: ?+ ^9 e  ?
ns_marquee.left=marqueewidth+80 c( c# b+ a6 Q# Q3 B
}6 t% B( c# f8 B3 h6 z/ z
}6 t  ]# f1 C4 e4 v  X
8 n7 C0 X& i- B5 m! E) `) u4 ?8 E; c
if (iedom||document.layers){
8 p/ w2 E3 t( L0 K# |2 Iwith (document){2 @8 K1 U9 T1 |0 w( _5 s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  {" r1 z! H3 Q' y8 K  _
if (iedom){7 N+ E, b# m( ]7 X; a* V- P0 J9 T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 w) h0 Z/ ^0 K% n9 z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# }/ q  D! ~' a2 w: Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 w8 Q6 ^- u' U9 I3 r# awrite('</div>')
: c4 v! P2 N: |* M/ A. W$ I* I}& A5 v' W, z& R# U
else if (document.layers){
$ A* p, q' L1 O0 X& L* I" u6 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& @' b+ |0 n2 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( r) l8 A# a; Ywrite('</ilayer>')
6 `# v7 K: {( h. ^. E8 y9 s}) E, ^8 m( Q! b) [) y+ ]7 Z6 G! R' F
document.write('</td></table>')
* ~' h) u- [4 O5 r4 d- D$ h' ?  B+ o}
( h0 y. ^/ l# x/ G# m# L0 `+ V: }}: P+ v7 }0 u2 g- g7 a" f$ d
</script>

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