返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ ?! M+ `; K. @+ j0 n5 x$ {# a
var marqueewidth=300
, U/ P4 f5 `0 H//高度
) X$ u) G- O3 J" Dvar marqueeheight=25
9 Q- g1 A8 o* s$ \2 a& l6 b6 v//速度(1-10)
) _7 B: `# g, I. ?. Fvar marqueespeed=3
! B4 m' g; F% P) U7 b. q; F- k/ K//背景颜色
) f6 f; `# e& @4 Q2 B. {var marqueebgcolor="#FFFFFF"
+ r% ]* T5 Z4 ]) N! t8 l- s//是否能暂停 (0=no. 1=yes)?8 D/ S: e( s; Z2 w
var pauseit=16 g6 \7 Q/ X' @' y! g

: M( {6 k; Y9 K//修改显示内容
  _! T# M7 m" D- Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ O  a- c9 h1 x% s- F
! ^. `# m6 c8 l7 k7 {0 x7 @7 w% n; X5 M0 ~
////下面不需改变////////////
4 S' q! C3 ?8 Z# {% X: ~$ @
& T/ u# D$ r. U+ e) y, H3 rvar copyspeed=marqueespeed
1 x0 U/ ~0 c& u5 Avar pausespeed=(pauseit==0)? copyspeed: 0
' k0 R" d9 z" a/ k. }2 K- @! i' vvar iedom=document.all||document.getElementById% R( [; e3 o1 O4 [* t0 l7 [
if (iedom)
' T& B2 N7 [, Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 Y, w4 R7 u4 z/ H! U# k( @$ Hvar actualwidth=''
8 m+ _2 L: K" ?7 F; ~5 C: zvar cross_marquee, ns_marquee. {! |! ~8 p5 g$ d! ~( Y% r* A

' p- ]& x3 O3 E7 M  Mfunction populate(){6 D; j9 m, n0 ]6 O+ o
if (iedom){- u  E$ A1 r* Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 L+ \/ a2 S" v% {# {( a9 bcross_marquee.style.left=marqueewidth+81 M5 w  }, E) h4 ~9 b$ ]% `
cross_marquee.innerHTML=marqueecontent
! y' _! j. S% t# U7 P* Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( F8 [1 [4 S, v# {- d) m! |
}
* N. p  `, H9 g" j  r/ D( g, melse if (document.layers){
9 J& s6 {( ?+ gns_marquee=document.ns_marquee.document.ns_marquee2' {0 m4 F5 A4 s% t$ j5 ~
ns_marquee.left=marqueewidth+86 \& `9 C7 Z( b' Y
ns_marquee.document.write(marqueecontent)
' e, _) }0 [7 L$ B, E8 S% c  Ons_marquee.document.close()9 a& l8 k# K: P! _9 q
actualwidth=ns_marquee.document.width6 M% _7 m, ?* |/ V' }
}
9 Z/ k7 ~& Y1 I/ H; ?; b  Xlefttime=setInterval("scrollmarquee()",20)( T4 d4 u2 x2 C+ W8 h0 [4 i, ?
}1 j4 k; j8 u! f! B' c, c
window.onload=populate
' o; z# ?* T; Y  d/ {8 r  i
; {6 F- m: r) m) P# t+ W: c% _function scrollmarquee(){
6 F9 {, D# P8 g$ Eif (iedom){
; J# A/ G& u9 H$ t4 X! ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), `6 \8 v6 i" u. K5 z3 j1 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  ^7 @. t  y0 [* |! x: Aelse
) e4 M- F; d) {8 b: I7 Ucross_marquee.style.left=marqueewidth+8/ Y4 a, c6 E( \" Z7 L0 `

  O  e5 P4 `- W/ s5 s2 ]% F. m}1 ]+ D: m( a, y
else if (document.layers){
  X) f/ u+ D7 Y; ^7 _3 O7 uif (ns_marquee.left>(actualwidth*(-1)+8))
1 H, g6 J! E' b% d* Rns_marquee.left-=copyspeed
9 R( d$ g, i3 z- U' Qelse
* n8 a" b5 T7 a$ R, [ns_marquee.left=marqueewidth+8& a2 v" h. W: Y+ z) q  M' Q
}
2 ^& z- W% R# M}
; D  N9 c8 E; v$ s# g/ @1 g" n. v7 B* f) k
if (iedom||document.layers){
3 s8 _4 \" g3 q2 I- i: _, k- Z+ Xwith (document){) A& Q2 R/ r: d/ N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). Y) ^; ~9 o- O7 `: y1 @
if (iedom){- X- v% u9 X$ q- d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ Q; c$ [3 C9 `% O+ S/ zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ \# d7 K/ t2 Y# a' k9 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); h9 H3 G  s0 l, m5 {
write('</div>')
; E6 X$ a, n' p% L$ D6 W! U, Z: E}: l* z! f* X, b( i7 g' J" ]& U
else if (document.layers){: r( Z1 A- j8 P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 y; M* t- \$ c, p" o0 s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 E) j: N9 F; h# h( z6 i( iwrite('</ilayer>')
7 p( `3 k7 y% D% l/ q+ a& `}
9 P/ O3 |, \* E2 ^9 {0 B& edocument.write('</td></table>')
; V# Y( \+ u- N  b' Y0 B1 V}
8 F+ Z3 f' h+ {5 G& D}
) L7 P* ~& ~9 v: o$ O. c$ r</script>

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