获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度* n, e& U' X/ e) W3 ^3 n+ _% l
var marqueewidth=300
1 L% K2 f$ _7 ?2 y1 G, C//高度" }6 h6 o3 w# S1 @) |7 N2 c
var marqueeheight=25
) F3 J3 b  c7 }( u/ i//速度(1-10)) s' V& N" R" ~7 \) j
var marqueespeed=33 G# Z3 u% C3 l! c7 P) y8 j
//背景颜色$ x, Q5 ^( U  q7 z7 d; p
var marqueebgcolor="#FFFFFF"
$ `$ T9 ]7 Q; o1 f, |) g& |* a( u. n//是否能暂停 (0=no. 1=yes)?
3 f$ ]1 r# c( X( x( B; Wvar pauseit=1
5 z6 r/ B* Y9 r! c( ~' i) ^; n0 t- A3 R
//修改显示内容. ?! u$ Z+ y/ }8 M3 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: i( q' b" S' `1 ]  r! K" V+ L1 |- d2 w" C5 O! L+ t* S

6 p, O& i! i- \+ j  z# X5 a( W////下面不需改变////////////, l, x6 J1 Z; `% |$ R4 ]

' U2 w4 H" k+ i0 v5 U: U' o: ^4 n- t# Kvar copyspeed=marqueespeed* u0 S* j5 K, h  h
var pausespeed=(pauseit==0)? copyspeed: 0
4 J2 ~/ o1 {$ |/ |5 @' qvar iedom=document.all||document.getElementById
2 T7 r% F( o2 i6 z& K* P0 Iif (iedom)% X) Q7 T7 H1 U; _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" R% x- `2 t5 S0 i# Yvar actualwidth=''
( d* |: G* m. V4 }var cross_marquee, ns_marquee) G0 e# P, E4 c+ @1 O& u( m
- F* n8 x6 W0 h' y0 \6 a; w
function populate(){
! ]; F( q- l5 B, g* v# h6 Uif (iedom){
& Z1 \+ G) R: b+ X0 |: Q2 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 z) N, G' W7 e) c  [0 P
cross_marquee.style.left=marqueewidth+8
8 }  |4 Y9 d1 Y/ S0 e5 u8 [$ z) o0 ~cross_marquee.innerHTML=marqueecontent% \9 X  p7 h7 L0 e. O! Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 S, O- @# M  k; M1 O4 I}& w. `. q; ]& C( N9 S7 S- T# W& O9 L
else if (document.layers){* e% C8 q- M$ ]& u0 q
ns_marquee=document.ns_marquee.document.ns_marquee2
6 O5 l) s1 X6 e( ~9 A- Sns_marquee.left=marqueewidth+8, N* e; H. r& y: e
ns_marquee.document.write(marqueecontent)7 M$ w. H1 K0 d* `1 J6 q
ns_marquee.document.close()" D4 e  L0 J" T% X: \9 F( W
actualwidth=ns_marquee.document.width
/ ?$ Y  m3 P7 g4 R& g. j}; k  j) B- n  {+ ~" r5 x
lefttime=setInterval("scrollmarquee()",20)
8 |) u+ k: \" J  S! A}
4 ?- C* ?; T1 `$ t7 A# twindow.onload=populate. p9 M7 v6 D& O2 R

' c6 R8 r; g8 W2 M  V  Gfunction scrollmarquee(){7 G5 }( [( v+ `& u. c# W" d  }
if (iedom){
9 R! C# N6 |( Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 C, x# }2 P) E* h+ c+ ]# ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 k1 e# U4 O; {/ v' Y; U) h- |
else
9 u/ R5 c: T, @) ^( V+ Wcross_marquee.style.left=marqueewidth+84 o7 M* V8 @  R, l  H; T* a  p
. ]6 n$ Q6 S! s
}* N% T4 D7 _, q% w  K. C
else if (document.layers){/ d5 ?* V) ~) n0 h( y" N
if (ns_marquee.left>(actualwidth*(-1)+8))
) r) e1 I! I: K! v! l2 S" Mns_marquee.left-=copyspeed
" V( Z# a. v- n4 \' b5 s7 Pelse
  m2 C" R$ l2 a2 w, Wns_marquee.left=marqueewidth+8
1 l% L  [( K6 K; i. k/ d}/ T6 |& C; o; J1 {7 q
}
( K, A0 q, ]# w0 x, |: Q
: u$ t: f( L5 O' F4 }if (iedom||document.layers){2 n0 N* W# A1 o: v0 c. R
with (document){6 u2 h5 l! d& E! F! Y+ O$ c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 u4 \2 a% ~$ c+ ?- u! Q; Gif (iedom){% ?3 {* B/ b' z* l; \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 Y+ b! y1 v/ X/ _7 S1 u. l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! ]  Z6 P: ^9 I7 Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 l5 T4 c$ H$ H1 x) ~write('</div>'), ]7 j- q3 |" X6 F2 X
}
; O( D! x1 u- g# Gelse if (document.layers){9 v+ B/ p) W5 X% ~4 L3 D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% X7 a* \% {5 Q1 N1 q  A; `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# m8 _7 k/ q& Q; T6 o( ~write('</ilayer>')2 V# u! a# V( h0 ^3 @* s9 ~2 N
}! H/ w0 n7 J8 l2 s2 f. K3 H
document.write('</td></table>')
, N% J) g9 S9 t) W. Q; A# T" n}, j; M8 ]/ v; I- ?( o: b+ m% I/ a2 T8 @
}, A$ y1 `: i' Y( ?% H
</script>

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