返回列表 发帖

网页之跑马灯文字特效

//修改宽度% D  b+ u1 k; _. P+ f
var marqueewidth=300- k; d" L+ b1 f
//高度
' T& B7 ?6 H! n: ~  F4 Wvar marqueeheight=25' v1 [! x- m5 J; W' I% d
//速度(1-10)9 m" m% v# F1 ?8 Y% @& u1 S
var marqueespeed=3. L  d0 X7 b$ y7 V3 j" w; ~* B
//背景颜色
% J/ d8 D4 T5 K/ f3 avar marqueebgcolor="#FFFFFF"
1 q9 v9 g* ~2 ^) Q7 Y9 @: D, U//是否能暂停 (0=no. 1=yes)?2 X$ W* Q' O* Q7 ~! s
var pauseit=1
* n9 n" C! }/ \, n  U4 s4 A0 p; Y: T3 Z8 |
//修改显示内容/ b) q' D9 w# i( P8 G* A/ J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 X# k9 k; o5 _/ t, i
8 ^3 d, ]; O6 Q5 g8 T

, x8 `, h" \: Y" S: g% T////下面不需改变////////////
2 R, d- q, G9 V6 Q/ y9 _" ?3 ?; C* B2 |( M& R9 ^) o% k
var copyspeed=marqueespeed, \3 T* T3 W2 t" a% a, J
var pausespeed=(pauseit==0)? copyspeed: 0
! _+ |; M6 X2 ?+ W' Xvar iedom=document.all||document.getElementById1 K9 w# I7 w, M
if (iedom)" f& R# ^) e0 T6 E3 y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% q( w" T/ @6 X9 |var actualwidth=''
- w! _1 v  _& O$ `+ o- ^1 G: Pvar cross_marquee, ns_marquee
/ I# ]- |/ Z1 @- E/ e; _3 _: D4 u  L0 n# t3 _
function populate(){& h' Y; m: c& }1 G
if (iedom){
- X# j) \7 X5 q( I6 Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  `# K! Z2 k2 A# W6 X/ X5 D7 O
cross_marquee.style.left=marqueewidth+8, Y1 ]1 M, Z' P5 E$ A3 v* B
cross_marquee.innerHTML=marqueecontent# M0 M; z( f- X( v1 v: n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 p! H/ \, q$ F& w. H. i}
& S% ~+ x2 S# s# x  \+ r; J, Selse if (document.layers){
- ~/ S7 \  u: r& r  {ns_marquee=document.ns_marquee.document.ns_marquee2- s* z: U$ k! e( I& o6 T
ns_marquee.left=marqueewidth+89 ]6 E9 U" C8 s: h! `8 L3 a
ns_marquee.document.write(marqueecontent)
1 _3 E- r- M; x. D2 W) I% ^ns_marquee.document.close()% i' c, C5 n( l
actualwidth=ns_marquee.document.width
4 p4 i, _  g0 H$ }}
  `( ?9 c2 J5 z: Ulefttime=setInterval("scrollmarquee()",20)
- S. ?7 B1 r+ B}8 P1 n6 C" d; i( k
window.onload=populate
3 ]/ y& q# D' y% T* s. W6 o/ ~/ A' Y- {  E- f- t
function scrollmarquee(){0 P3 k4 |; _  a% {1 {' Q  S. c
if (iedom){
# d8 S" n, D3 d/ j$ _. a' tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& x4 N; |( |2 ?( }3 ]* Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% I  w$ Z9 }+ Oelse
5 s, A! P3 W( y) I( Ccross_marquee.style.left=marqueewidth+8
! e; M4 a- {  d
6 V+ o7 {. x, w; R# L$ ^}
) u  X# z- C) F1 a2 Aelse if (document.layers){4 m+ T: N/ T4 R$ W
if (ns_marquee.left>(actualwidth*(-1)+8))
4 g" U5 J3 u4 S9 G0 uns_marquee.left-=copyspeed
1 Y' |2 |6 \7 g# R! Uelse
8 n" u. [. i/ r# U" T3 F3 rns_marquee.left=marqueewidth+8
" ]7 u( v- H5 K! `; e/ i+ A3 I}
1 @8 ^( `5 U  q- o. B* a7 u2 N9 n}
  z/ q' V$ `) G. O1 K1 V) B& {
- b( Z+ G  ]6 k7 wif (iedom||document.layers){9 ~) |4 D$ p9 C. V
with (document){
. @4 f1 P! l+ _! S" p3 w7 @. Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 ~: R7 r( f2 p3 J. M8 w( U3 L4 I
if (iedom){( g8 ?: t  K: s: f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% r$ \+ S8 c) h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 Q; ^6 G1 B7 m5 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& w# _* L" L! Q2 Owrite('</div>')3 u* }9 U/ f1 ^3 z/ m2 @
}! j# R4 \% a5 y6 u- l# H$ q% m
else if (document.layers){
9 e) V" Q& A0 p- _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ i0 H; V, Q' F( V7 o. e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 D& o8 V+ |& x% d
write('</ilayer>'), A2 M* W" d; o# p" G! u' {  E: i
}$ Q0 B4 n- b- K  z5 Q2 Y
document.write('</td></table>')# a4 p5 f+ x6 ~' D1 R
}
8 O$ ~2 M  J8 z. d}. {0 @" j9 l# ]' H% ?
</script>

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