返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. Q1 G  [2 x+ v! p5 ]/ c( [var marqueewidth=300
4 k, g1 h0 r7 }' k//高度+ X7 F" ?3 K) v, |
var marqueeheight=25  W9 l1 m# j: |  m
//速度(1-10)
; }/ e0 Q; i6 c4 Qvar marqueespeed=32 @. s- X" ]$ ]  z
//背景颜色
) O/ A! [; v+ m  |% Y' Nvar marqueebgcolor="#FFFFFF"3 x% A2 I" S/ V* [8 _! O6 y" I
//是否能暂停 (0=no. 1=yes)?& A/ H( a) {" p
var pauseit=1
" X/ }7 p9 R) H. k7 Z" N1 c* @+ L
+ L7 r/ a0 F, E) [: q//修改显示内容
, J3 Z! t0 I& Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ~1 v& m1 [8 O

- l- M6 q7 M; Z2 l1 _- ]/ P0 j4 I9 ?/ t  U5 m, M( {
////下面不需改变////////////
) u. [) j7 `+ B8 m- |% }: U9 S4 @" K! a) m9 P; Y
var copyspeed=marqueespeed. H: e3 H1 ]2 n) l% V3 ?
var pausespeed=(pauseit==0)? copyspeed: 0
/ [: I5 w. X  o2 ^var iedom=document.all||document.getElementById1 A7 D/ q# m- g9 [5 z: @: X; z. L+ P
if (iedom)6 T- ?6 E9 P1 t/ j% r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 m: \: o0 H( l; {; {var actualwidth=''
' C& m  R$ J- z/ R: X% ]var cross_marquee, ns_marquee! e+ ]: E9 d3 q& N- u- @5 ]* t
/ F8 y' M3 z9 @$ x! ?4 E; T
function populate(){; \$ }" ^% k0 r- x( B6 A! b
if (iedom){
, h$ @+ x( d7 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 \* e( L$ e* v5 o6 x$ icross_marquee.style.left=marqueewidth+8: n' M& |) }8 u) g
cross_marquee.innerHTML=marqueecontent
' u6 p; R- L) J, K$ J0 lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; U' K, {% c5 U}8 e# ?1 q+ J/ w  `* c0 r  H' m1 Y
else if (document.layers){) m3 ?4 L) r* t% Y( |& {9 v
ns_marquee=document.ns_marquee.document.ns_marquee20 `  Q3 \: }! F5 u2 l
ns_marquee.left=marqueewidth+8
) r5 T$ L" A& a/ A% C5 ^; tns_marquee.document.write(marqueecontent)' s9 `, r; _: g& [; u- b+ d
ns_marquee.document.close()- k# A5 d3 U5 W6 c
actualwidth=ns_marquee.document.width
" D' \% L& c' a0 e}
5 P) }: ~, Q  o  |: r# x9 @lefttime=setInterval("scrollmarquee()",20)3 m& q' Q( a0 f5 K* v5 x6 d
}6 z9 y# r+ I+ e1 @6 p" X
window.onload=populate8 b' D/ @( i' I* o0 U4 [8 H

( X: h2 U: r! [8 m  A* Zfunction scrollmarquee(){% p7 Y+ \8 A# q! X
if (iedom){' O. T* h  j/ ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. d0 Y5 ^$ G7 v7 A, ]' C7 P; i7 Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; n1 b, ~) H- x# W1 s  X
else2 y) D& h" Q& a" f
cross_marquee.style.left=marqueewidth+8, s6 X: I! K# p5 {5 P% k

: a+ `0 E2 Z1 h+ o" K. n}  @' o/ N; _' ~. Q( I3 y! e
else if (document.layers){- a  }; I' ~4 d
if (ns_marquee.left>(actualwidth*(-1)+8))) g( ]+ Y  K5 ?' s; w0 z
ns_marquee.left-=copyspeed$ {, d: v1 Z) A6 I
else
0 o# a. L$ Z5 _6 Z. N  s* k3 U5 f6 Bns_marquee.left=marqueewidth+8* d- P. m& G+ K
}& ]7 E" N+ U! C1 z' @
}
8 H& N# D7 E- [8 @2 b( V- D
9 ]+ ?$ y  I4 Tif (iedom||document.layers){2 P6 ^2 [+ V  p7 w- \) H* Z) \/ Q
with (document){8 `& O8 G- K' l+ n$ J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ x! K9 q7 E1 [) d6 [
if (iedom){
+ M( @, C# g5 J/ E% \! d; m6 j  Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 D& C" ]7 b# A- Q! Z  A  {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 L2 }* ?7 N# ~2 \! \6 n7 f5 Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% s7 G- B/ m; D  X8 {  @" N& lwrite('</div>')
  c3 ?7 m6 j& ?. M2 c. h' _3 F}
3 N- ^% Y, E# r+ j, `else if (document.layers){
3 y& e2 G: f0 B+ ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' z+ J  s' j6 b7 l1 U% H+ n/ I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# t6 @. D7 ]6 `: w. Z- c
write('</ilayer>')3 z6 m& u$ _) z( C
}9 V* B3 L* F  j9 d2 K$ M
document.write('</td></table>')( \  e" @- O2 N8 Q4 c% Y; Q
}
, q, l$ y0 T- H) x$ d}2 `- b$ @# x! O
</script>

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