返回列表 发帖

网页之跑马灯文字特效

//修改宽度, z# I; k* c( N& W: g
var marqueewidth=300
# _- E1 Y2 @- R  i. i//高度
3 d6 X8 G# v2 \# F: Q5 b1 \* u( Avar marqueeheight=25% W) Z! f* Y, e2 v0 B2 {! S
//速度(1-10)
) y2 ]- }0 b6 }  d2 G" vvar marqueespeed=3# B& h) \8 M4 K0 c" g1 A
//背景颜色
; g8 n# m$ ~. M8 v9 f7 R( hvar marqueebgcolor="#FFFFFF"
" j/ Q/ r  w. y- G$ `//是否能暂停 (0=no. 1=yes)?+ i% `% m2 d: M3 [$ n( q4 s
var pauseit=1
, k7 D6 B: h& W' n5 _3 K0 O0 ~+ y' f# v# h  t* m+ O, d7 j
//修改显示内容. v( k) b( X7 w, y- y2 l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  ~: _. `) Z8 z$ `  M0 k' `, c5 m+ F1 I$ x% ^) J

7 V) |# k# K& x3 [" |9 B////下面不需改变////////////
0 `" H. w3 `4 @9 P/ J/ O( I1 N  Z. a- M0 H+ L/ v
var copyspeed=marqueespeed
# j# k: G9 u2 Y, J3 o4 xvar pausespeed=(pauseit==0)? copyspeed: 01 `* h. K% j+ }9 G) N4 g+ N
var iedom=document.all||document.getElementById
2 I% Q# N! H3 A1 Iif (iedom)
) n" `, L1 T! @6 u; vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). S6 g* K$ i% K2 V# h
var actualwidth=''2 t' V% w! n- u$ Q, Y6 p
var cross_marquee, ns_marquee" t% s' C+ b: Z' g+ A9 v, x
  Z3 w7 p) Q* w8 T! h* p7 l9 @
function populate(){
. [0 R$ A+ I0 G$ \* v$ nif (iedom){
9 l2 ?' V- g. ~; R7 Z2 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 T; e+ p0 D7 {: \' O4 e) hcross_marquee.style.left=marqueewidth+85 O9 l, b& |# T9 K1 e
cross_marquee.innerHTML=marqueecontent" l0 ]9 u  H1 O" j1 f: }/ {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 }$ m7 y3 s" W4 B4 `0 t/ F  q}! X  I% {# o- A9 B, f
else if (document.layers){$ p/ S0 f) J& ~2 Q* |( V& J
ns_marquee=document.ns_marquee.document.ns_marquee2
* b( I5 l: @( S+ |! w" }5 @ns_marquee.left=marqueewidth+8- Y) y! |: B% G& G% L7 q8 v- j
ns_marquee.document.write(marqueecontent)
  t; F, `, I* J, f& S. Z: Q7 Mns_marquee.document.close()4 Q! _/ B0 a3 T" [% D3 D5 j
actualwidth=ns_marquee.document.width, D( {& B) Z3 P+ Z1 t
}
" T' j' |3 ?% jlefttime=setInterval("scrollmarquee()",20)" s1 Z7 Y/ z0 R8 L: Y
}0 V/ A5 J: C  m) i8 `' a4 J
window.onload=populate- g) i8 H! Z% u4 d* F" X  k7 D4 \
% ^* v% Y1 Z) \
function scrollmarquee(){
% `# T) W2 `; \7 s* Rif (iedom){
7 r5 y/ [% \5 n5 j7 n6 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* ~% M/ p1 Z+ Y8 J2 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 D' D. b4 X* x. p! h
else9 i- O0 a8 ]: b  y4 A
cross_marquee.style.left=marqueewidth+88 D6 t9 v$ J: T. f4 Y
; j8 ]- ^! {" V& B% A' m$ T% ]
}
. P3 o: }3 q  A& o4 s" x4 eelse if (document.layers){
5 r0 R8 f( [" Tif (ns_marquee.left>(actualwidth*(-1)+8))) f- p5 [) j  H4 L& P7 Z5 g6 O
ns_marquee.left-=copyspeed
) u/ [; b2 C3 o, J4 Delse
+ ]1 H) Z1 G0 i3 G2 ?6 G7 t/ pns_marquee.left=marqueewidth+8
: ^. _2 _9 ]/ L. `4 r, m}. L3 W0 H7 ^2 a1 B, G$ c9 G
}& p. u' s8 J/ d+ C9 j8 V

+ ?5 @" V. _! c3 q+ |if (iedom||document.layers){3 j2 W& E  c/ w* M) E2 T  d: j
with (document){
. K: {+ n; N# i( U: o  `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- V* E) `0 V2 N# x" h! r3 D& L
if (iedom){$ `7 F' d, [0 Y8 d: C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! {7 {1 z- O& j% _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% m6 ?. H# B" n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 N. z. ?) L' T5 S7 o1 W1 E  ]write('</div>')  l, Z" {2 W( j8 x$ S
}
7 Z/ s* Y7 N, M+ L( n# R4 helse if (document.layers){
! S1 ?( p5 y, `& swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ U; O' D6 D0 a( kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* l# j9 x) O$ w2 l1 q
write('</ilayer>')
8 D* D1 N: z/ V% x/ z; ~6 y}
# Z' D, x0 W& x9 A" X) ~document.write('</td></table>')
. p* a3 e- K: C7 }3 A4 x; @}- H. B. H* J& I! S
}
, J$ ?% H! C, L& E- ^1 S3 q0 c, Z</script>

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