返回列表 发帖

网页之跑马灯文字特效

//修改宽度' @7 o, j# m. J2 M* Q5 b
var marqueewidth=300. N7 P4 g, N2 w$ q0 y1 D6 `
//高度
( O) G/ q+ a# G- }( a9 P5 l+ fvar marqueeheight=25
' e( J, A7 D$ j; @//速度(1-10)) j; }9 n# P1 _" S! u9 O
var marqueespeed=3! g2 A: g' Q* y2 T& y. Y$ i- W
//背景颜色( \4 h. [; P  R$ e% z7 v
var marqueebgcolor="#FFFFFF"
% G: i& k  |% }1 j) i( B//是否能暂停 (0=no. 1=yes)?0 P, J  F! H8 k  _1 T
var pauseit=13 D( s3 w9 i; i9 K3 w# V
# K* q- m/ l0 N8 K# w, q
//修改显示内容
" T- |1 ^4 x1 k: y& }* k, B0 `; K0 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! y3 `! O; R( m5 z
3 r: L9 r7 F6 q7 e$ c- ?
: d6 `+ g+ R4 g: m( ~. o# p' ]6 h
////下面不需改变////////////
! i3 B, _) Y/ |# }: N  A1 P9 w
! _8 o2 M- ^; V- b7 X' ~5 e) F* H5 d, Fvar copyspeed=marqueespeed( |3 q) R2 ], }
var pausespeed=(pauseit==0)? copyspeed: 08 {  X6 Z" Q" g. w* U" k  R& d
var iedom=document.all||document.getElementById1 E: h2 [3 h8 Z$ z6 q
if (iedom)
2 R7 r- \! d9 F+ B5 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  ^- e3 M4 ]5 B; Q$ Yvar actualwidth='') ~* q$ A' q; ^* ~: Z0 M
var cross_marquee, ns_marquee7 t/ i9 i3 N5 N9 \
* Q( B1 f9 ^) ^3 z
function populate(){1 ]. x& c4 G7 w( O$ x* e- s6 ^7 X" j
if (iedom){: ~' {" J% _' _! D3 H% w$ |0 o) A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  s" L" _: ^" A* X- jcross_marquee.style.left=marqueewidth+8
: u/ Q7 k) z4 k% G1 _1 `  P% f& @cross_marquee.innerHTML=marqueecontent
6 q2 ?0 h  K0 P5 A8 P9 Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: H. l" M1 W# ?; v% G5 \) e
}
7 S2 p: U$ T% w" \' yelse if (document.layers){
/ H+ h0 A+ @: S; {7 ^  v7 Nns_marquee=document.ns_marquee.document.ns_marquee2
; h9 q( z; A! e9 x$ Y( N  Yns_marquee.left=marqueewidth+8: a2 v  R/ a3 ]. k& ~6 u- c2 Q7 ]
ns_marquee.document.write(marqueecontent)% i4 D& c' u. V1 d4 w& i
ns_marquee.document.close()
- D8 A0 K$ |# n/ g8 p, v; {actualwidth=ns_marquee.document.width
  \& \% d; |9 k' j}8 r8 P" D' W- t6 m5 T( K
lefttime=setInterval("scrollmarquee()",20)8 p4 \7 h' k- c- w' Z
}, f4 m# E. @5 A3 {/ V
window.onload=populate, o# F& n$ k% H9 A' ^
; ]8 e5 d& Z" y# I) `
function scrollmarquee(){% M( `: \! @9 l0 S
if (iedom){+ K% H5 S7 |5 a4 O7 ]$ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ l7 e: F  P# {+ l0 [+ S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" W* T: E5 m; I# ]else
/ Y1 G' ?) T( M4 O) \cross_marquee.style.left=marqueewidth+8( x4 M& G& f$ y7 l+ j; X

5 |, }3 ?# ^1 |  z% r}" U$ V9 ]1 `8 j
else if (document.layers){) _, r$ G: E% p5 N) i8 K) F
if (ns_marquee.left>(actualwidth*(-1)+8))! m3 \& {2 q% T6 s$ w
ns_marquee.left-=copyspeed% P. W, V5 F2 u, ?1 x$ y- u  V" P
else1 u& `' D" P  C# y6 O' ~
ns_marquee.left=marqueewidth+8
3 R  Z0 @$ {8 w) [}
" L, U$ h+ M# z6 ~% M7 D}/ i( _( U& [! a$ z% V
; y5 I# z/ {+ J( W3 g! K
if (iedom||document.layers){
0 m" S# ?4 b! V  N. i$ o: v9 R% hwith (document){
# K% C! T; {& O5 K( Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* h' `* l' k* t8 D" u7 r4 Q4 dif (iedom){; r: \& u* ?. n( P8 U/ }; j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" {- c, L' X0 K+ I0 n5 R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! n7 }" [1 x7 F9 F! pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. G& A: C+ ^( uwrite('</div>')) {, E  \7 t' c4 K  Q
}% a' l7 c5 r/ Z6 K
else if (document.layers){$ |, @: @4 W  m0 l7 `2 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 V) C! Q* ?8 o& Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 F0 y# q% ~* {1 {
write('</ilayer>')
. U5 C4 a/ \& y- U/ H( k" _' d! k}
& q+ Q$ t% x2 ?7 h# pdocument.write('</td></table>')
* J: X% D% G2 ~5 G" n  Y}* b( s8 A9 u8 u; w' g1 o9 }$ P
}: v2 X9 K9 t6 i) G( U) x, L4 N
</script>

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