返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 E" H6 R0 d! A( Y( M% nvar marqueewidth=300$ w' G! q; k, e1 X, P
//高度
/ m! q# e* U: C% G, Kvar marqueeheight=25
6 x- E) H, i7 O4 p. y//速度(1-10)$ w9 I" }3 n# t8 K0 G" d
var marqueespeed=3
: J$ W# [2 O' ~8 e) Y//背景颜色
7 t: h+ B# I# k7 v0 K6 pvar marqueebgcolor="#FFFFFF"
) @, ^; F, L9 I' j//是否能暂停 (0=no. 1=yes)?- L4 a0 d+ c: g/ d  B, o
var pauseit=1. L1 A4 N4 Z4 ]) ^* h1 v+ z5 x$ ?

7 U) P% p, F0 R7 ~3 ]//修改显示内容# m' b0 g( r5 ]. |+ c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', h1 U; b9 Q1 G, \* G* g: _

5 `$ T: Q: R) \" o6 L3 h: i% L- f! v0 q: x3 Y- q7 M, b
////下面不需改变////////////* v, g* Q' j9 o3 y

; c6 w. W% n1 }( G. i) E% k. U# ivar copyspeed=marqueespeed
% |3 E- R: j2 \6 @" u, X- {var pausespeed=(pauseit==0)? copyspeed: 06 |6 I1 U, @9 u' a
var iedom=document.all||document.getElementById
! _2 L6 o. t! _5 Z* c6 x. }7 S5 Hif (iedom)1 B' [4 R  E8 a0 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; M( h1 N. P3 S. p# O% zvar actualwidth=''
' c. u5 E5 Y( z) d  P0 z4 U3 Ivar cross_marquee, ns_marquee
( T3 Z$ g- j- i
3 j1 B1 X, s$ l2 y1 }5 V3 a7 N4 Tfunction populate(){
& U2 O! r# `8 ^7 t: h$ kif (iedom){
" m: e- p8 }3 L. d5 j% ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# X/ x# o) d5 t! Q/ z
cross_marquee.style.left=marqueewidth+82 O1 N  o! S4 J4 ~$ Z: f; w
cross_marquee.innerHTML=marqueecontent
4 n1 k& T0 x3 i3 ]0 k8 Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, U6 X2 y! t6 |% |3 F
}7 |) P& N1 n, H' c% v
else if (document.layers){9 b. t! L& I9 ?$ T) ]  T& D% `
ns_marquee=document.ns_marquee.document.ns_marquee25 j. {: t4 H; D0 b5 _  ^
ns_marquee.left=marqueewidth+8
) |2 n! y1 Q7 u$ I. Jns_marquee.document.write(marqueecontent); h4 X: J( ]0 {' n5 E
ns_marquee.document.close()
# Z$ _6 m$ Y2 a4 f5 T8 g' cactualwidth=ns_marquee.document.width& T; f& p1 Q& d5 l% o. d+ A
}
( R% d( j0 z: M' o, Jlefttime=setInterval("scrollmarquee()",20)/ ?* g# h! \$ _( y1 u9 W
}, Y7 l; K. V5 g/ F
window.onload=populate* U2 O$ t; H! y5 C9 O# ^
+ p) `) Q9 L" g8 M% Z9 C
function scrollmarquee(){7 ~; w; J4 B" v) R. [# @, J
if (iedom){
6 }3 _! p  P$ n( i9 ?7 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" X7 N% n# C* o) `) j+ s! S1 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" T! @/ k" z0 t4 ]7 F$ w+ F3 y' selse  d, O# n' @$ m4 W' V  G$ g
cross_marquee.style.left=marqueewidth+8# t: z0 H3 v/ {+ m4 m/ d! e

  ?2 S1 A8 @5 n# \; t4 f}; e  p& y7 ]& l
else if (document.layers){: n( u5 }4 U) J& ]* D* c
if (ns_marquee.left>(actualwidth*(-1)+8))3 i3 X8 J* l+ P. R: W# E6 |8 `
ns_marquee.left-=copyspeed9 F2 T1 K; V: O5 y, [
else* B$ Q0 b- ^4 K8 @+ g* o  U9 G: _
ns_marquee.left=marqueewidth+8
2 a$ _, U' R% D  C6 T0 Y! Y' j( U}# u: w" c/ V  b: H+ _: f% {* A
}( u5 ^; c8 F2 B9 J+ O) |! K4 V1 A

/ x8 N3 A# z6 \) h' @9 q1 gif (iedom||document.layers){" S2 [( S; o, M; G' p
with (document){) {' |6 ~; |* S4 B. F) P  W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); |; q5 u0 X$ @0 z- ^$ b
if (iedom){* ~5 ]+ C1 I4 m! w3 L4 p) E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 B& z( T; G7 dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): q, h2 k! X3 n+ g3 A, k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). S: d' V; E5 m1 Y0 t8 P* x
write('</div>')+ q0 u4 l4 B2 N, I1 x
}
, k7 p& w6 j  w; Jelse if (document.layers){0 |. Y5 O! _. R  [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* X5 W! R9 ^3 ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 A; k' S& O# j8 k+ Wwrite('</ilayer>')- Z. w. U# b7 ^! r
}
* n; h0 _3 u- r) T8 [) zdocument.write('</td></table>')
' U0 I! h. M# [3 B9 d}0 ~3 u; m- T, x  T- P9 z
}
, V0 D9 N7 j' k( L& F</script>

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