返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 c+ K4 R3 v6 g) n  kvar marqueewidth=300
& E% J) b7 |9 X$ a% r# l//高度
- a! Q5 U# G' z0 A; t- C3 |2 gvar marqueeheight=25
* d% f/ u$ q0 \! O  }% I& `' i//速度(1-10), F: B& L7 Z# P; r! x, U" H
var marqueespeed=3. }, ~/ I6 B& |$ F, [5 Y
//背景颜色/ L' d- z! |6 V2 C2 Q
var marqueebgcolor="#FFFFFF"2 ?# p( G8 t3 K3 V+ @, C+ z4 s
//是否能暂停 (0=no. 1=yes)?
4 o% G2 P5 Y8 I) u+ P7 E# H6 I0 Cvar pauseit=13 q4 G8 H4 p# [
$ \' e" r+ ^8 T6 R, P
//修改显示内容$ W+ E. q' ?8 q$ F5 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 d" g, {1 s: R7 Y/ G& |! J6 S
% S) q$ ^/ \+ w& c# C

# l" ~- P$ W0 X8 R2 w////下面不需改变////////////  v* {& W' L8 E
  w( s; b4 W: L; ?) }6 ]
var copyspeed=marqueespeed
5 [  M+ G( G% e3 Qvar pausespeed=(pauseit==0)? copyspeed: 0
2 F# _  }$ ~8 t0 a9 v' Z% m% J! avar iedom=document.all||document.getElementById
$ A3 b% ~9 }4 W1 yif (iedom)
( b- S7 |7 Q9 Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; {# a) ~, t$ c/ Hvar actualwidth=''8 Y' L  T- N. b1 P. O) L" [
var cross_marquee, ns_marquee
1 Y. z% T. _8 z7 V* Y5 f& l" T" k
  ?  \4 H) R8 e' }# }8 o  Afunction populate(){
/ [- `. @! B0 ~. y* g% W) p2 jif (iedom){
6 S! J* g. }2 I& pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, n- U* g3 _3 [cross_marquee.style.left=marqueewidth+8% J8 p3 r; L6 x% q: W
cross_marquee.innerHTML=marqueecontent' s$ @% D5 n( P( v* I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 j* V# z; ]7 X$ z, I3 r
}! F2 E  M0 Z, a
else if (document.layers){/ Q, p7 l$ n7 l# Z, q. K- \* G
ns_marquee=document.ns_marquee.document.ns_marquee2
( L3 p1 D& m! hns_marquee.left=marqueewidth+8
1 U# g. S9 C+ X. X* t2 L) \ns_marquee.document.write(marqueecontent)
" t2 u' @6 t4 ?2 U3 Z$ C) l5 g. fns_marquee.document.close()
+ A0 j: P0 y' N4 E# O  h& Nactualwidth=ns_marquee.document.width3 k/ T8 Y" J: l& m# E. Y
}
  w- e$ I+ G4 ?8 v" Ylefttime=setInterval("scrollmarquee()",20)
+ r9 c% F. w3 ~; D}: v! l* b7 d9 A7 _/ o( ^* ]
window.onload=populate
; M0 ]8 e* R) M6 r3 `
2 z* r' I) U* n9 cfunction scrollmarquee(){
" I' a, c9 c# E4 b, P5 o- l' xif (iedom){
6 c' w) M/ d  O* Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 W, K" b+ l% jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ p8 j3 C* s. ?+ L; k! m5 Zelse
7 S) @; ^+ J7 jcross_marquee.style.left=marqueewidth+8' b  @4 }' M8 u2 k3 i' _& G4 Y2 I

3 H2 {4 ~& t) c( l! t}
1 u+ V: K) R0 f7 oelse if (document.layers){: U& Y' i3 {7 k7 h
if (ns_marquee.left>(actualwidth*(-1)+8))
- d  a6 d, ~5 L$ cns_marquee.left-=copyspeed! o! T1 S0 t( s7 _5 A* I
else
* [" D; O" W& G% P. dns_marquee.left=marqueewidth+8
* l' q+ }$ }7 J}0 _6 Q) ?1 n( W3 W' n: x* w9 o4 q
}; M% Z, t3 g" O* a7 D, g& D

1 R; M" C3 J, |& zif (iedom||document.layers){
! @: J7 S3 p+ O% z! j: ?+ w! C' Zwith (document){9 P) d1 [5 ^; q* @' f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% r  z" h. @0 L8 R, ]( c0 gif (iedom){
& @' [) ^: h/ `+ E4 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! y: @- ~3 U/ x- Z4 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- K- C- t( U- Y- R7 C2 U0 m. M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 p# B+ D' R9 ], O, b0 y( X: V
write('</div>')
, B( `+ R; J% f" e}
0 ~% M. n5 {" T( Q3 g% ]; ^3 yelse if (document.layers){
- {3 ?  c7 T$ j  bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! H: {2 `! x" @, p6 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' y* ~: n) t4 v/ b' D; n1 u0 Cwrite('</ilayer>')9 w/ U% t6 o8 a: x5 }# r  `; s
}  o3 m$ X8 O) s8 S0 t
document.write('</td></table>')
) f1 ]! A# Z4 s6 G1 A}
# E! w  }' i2 ~4 i}  w: V. m6 t! m5 m0 V2 v
</script>

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