返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 J1 e4 h1 [) o& Z: S8 B5 |var marqueewidth=300
7 ]8 k4 A) s7 W$ H4 O* \//高度" |7 Z' D6 e, a
var marqueeheight=25
8 w% Q0 Y/ y2 h//速度(1-10)
) N  Y/ f# d1 D( V- R$ Svar marqueespeed=3( p  P" a9 A( v0 Y; k
//背景颜色
( u2 G6 Z: ]  m' j- Kvar marqueebgcolor="#FFFFFF"
1 q/ U0 \: C. }0 B. x  ]$ A1 R3 x, ?! c//是否能暂停 (0=no. 1=yes)?
  o  `8 }$ X0 k( s3 y. S6 }9 o1 dvar pauseit=1- s, h& K# m; [0 V1 j9 s# p9 R
' {7 w% U7 \7 D7 w' a& i  w) j; _
//修改显示内容
  g' m/ p( B6 J9 q3 v. kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. F  d" ]  f- P2 g  N3 p/ |: \1 C! B
- D& Q7 Y& B) ]. X0 u' g# }
////下面不需改变////////////
5 W$ y0 m( A+ [1 s8 h9 e) h) \# u- f0 N' I, U
var copyspeed=marqueespeed+ `0 F* B/ @& [3 n' L
var pausespeed=(pauseit==0)? copyspeed: 0
7 K0 V( s- ?; t6 h+ Q! c$ s/ y' @var iedom=document.all||document.getElementById
! N! v% `6 s, A9 w1 }, d4 j5 oif (iedom)! L2 i. W# R0 _( z' d$ f! f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 C+ e3 D" A+ K4 a' ^" c6 _9 l
var actualwidth=''
9 E6 X1 I" }3 `- d# zvar cross_marquee, ns_marquee
0 N9 J4 x$ Z( s0 Y9 u7 [4 \
4 p$ ]; p' o2 F( `function populate(){
: X) u& s# C! q" aif (iedom){' f% h" Z1 w& I2 P& V9 X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" X% C9 [$ q3 e6 T2 r( X& v
cross_marquee.style.left=marqueewidth+8; B8 K$ @* @: N0 R0 A
cross_marquee.innerHTML=marqueecontent7 K5 a- R7 u) p& @$ W- _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 Q* Y0 s; n' y6 a9 W
}( q% P) W" F9 l* a
else if (document.layers){
, _/ b6 J) M" b7 k' a2 I, \ns_marquee=document.ns_marquee.document.ns_marquee2
6 ]# c  Z9 U$ Z* A; P9 `6 k! dns_marquee.left=marqueewidth+89 r8 L& T% }0 |, L! C% K6 [& W" Q- N
ns_marquee.document.write(marqueecontent)
/ |- Z4 q2 X  N, R. Y, K* Z7 Ons_marquee.document.close(). Q% a0 W: K( `
actualwidth=ns_marquee.document.width  o$ s' E* h; q3 x; a
}8 V4 X, V9 H) `8 K
lefttime=setInterval("scrollmarquee()",20)
& Q& x( |) d* g7 V# l2 U9 _# g/ [}9 `6 E: e2 _+ _, F5 K9 I- s
window.onload=populate- J# N$ h" e  P( I7 q( M3 q% B6 F

) \# `1 V% `- yfunction scrollmarquee(){- y+ X: P  H1 L1 C, X
if (iedom){
2 F7 z: f6 @" j3 z2 `6 F# A8 ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ A$ Q1 B3 k$ u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; f0 i  I, B# x! A/ z* @, X' N+ L1 p
else
  D' ?2 d; p7 k& Ycross_marquee.style.left=marqueewidth+8+ q8 ~, x, ?0 {  }+ b5 ?

; p( V/ J$ I' F5 j2 ]4 G}
" `7 [2 G' J% [) R) D& belse if (document.layers){: a6 t% z$ t9 C. `4 V9 E9 C
if (ns_marquee.left>(actualwidth*(-1)+8))0 [0 ?$ M6 k6 }9 v7 h, ^) X
ns_marquee.left-=copyspeed
/ ]; z; B. T9 R# y: delse. E1 L; `8 g8 Z2 W' u9 L& j3 ]3 {
ns_marquee.left=marqueewidth+8% F. g4 s5 |0 y+ b& y
}
( H0 i4 J; {/ K$ J3 H) G}# O1 i( l" E$ q- W: J' {( ^; F

6 \2 f9 M9 ~; f( e9 K# Rif (iedom||document.layers){( d8 X' V, C3 t
with (document){% ?% t8 r8 Q1 g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' J7 F( [- Z0 ?6 F- y' i* i( Xif (iedom){
2 w# V1 l+ Q, Z# }  M) l( r, Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' _* t2 b; r! w# R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& W; k% [0 K, h/ W8 E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& u# r: E' ^+ @' D" M1 O
write('</div>')
6 G. T6 g- X( f9 Z; S, p}
, d# V5 B" {- [0 t. n, ?; Uelse if (document.layers){' S9 V  s  a6 B( ]4 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) M, h. w/ w2 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 X- C$ |( l% }  z, f6 w1 K
write('</ilayer>')
3 p& S4 q; o' e& z6 Q) h}/ U% p: f6 [; _
document.write('</td></table>')3 b: o9 o- f8 |! p% w5 w
}2 d( Y/ ^, }, A- M+ Q
}* j- c+ o& h7 B+ X6 r
</script>

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