返回列表 发帖

网页之跑马灯文字特效

//修改宽度% @2 W/ s/ M1 A# ?) x- X
var marqueewidth=300: F1 a- y3 ]8 g0 [" `
//高度
2 Q$ j' o; x, U) R9 V2 N  o* Cvar marqueeheight=25
6 w7 y& H5 u3 D+ Z1 S9 P( I3 L//速度(1-10)
3 I/ T0 t. _) z9 j. Yvar marqueespeed=3
( I2 g4 N" C7 e4 V; l//背景颜色
+ A8 v0 o7 a5 a& d, y0 v7 kvar marqueebgcolor="#FFFFFF". {0 N8 b6 h- J1 J: r
//是否能暂停 (0=no. 1=yes)?# S' B! k" Y( P) h+ T$ Q
var pauseit=1" q# H* [7 v( ?; T$ c( `

4 `, q2 h4 M( |, q7 D8 U//修改显示内容
& M" ?- h9 u; d% avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. Z1 L' o- o1 A) ?; P( f; j/ t: ~7 O2 g

) d4 a- H! ]4 @/ C  G% X$ }; ]////下面不需改变////////////
* q1 I4 I; p; Q- `1 A
& T% E3 j/ N( N4 jvar copyspeed=marqueespeed% @4 P  h0 W+ e# o
var pausespeed=(pauseit==0)? copyspeed: 0/ D5 j. {( m; |/ P3 T
var iedom=document.all||document.getElementById
: }8 b& T+ c2 l  T0 Cif (iedom)
# Z8 Q8 j4 F1 {5 X& s! A3 @" hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ W4 x* W6 u1 G1 f! i# K( W
var actualwidth=''
3 N6 f2 r6 l) |var cross_marquee, ns_marquee
4 e' S6 w# T4 b( f6 v( O' _! a4 O. W6 P1 S7 J2 c, D
function populate(){
; I7 Y0 G2 a9 R+ Q/ v' a6 ]  u0 Jif (iedom){9 f% J! o$ V/ y7 W- @  }4 J9 B  N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 K/ {4 {3 b8 B( |/ P0 o) wcross_marquee.style.left=marqueewidth+8
+ `6 T" ~+ l* l$ r. Rcross_marquee.innerHTML=marqueecontent
" K' S; R1 u! b! P9 oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 Q/ k( D- ~- W  @5 P! w}( M! p+ ]% R8 @6 X
else if (document.layers){/ ~9 P$ k5 k- }7 P5 z* D: ~
ns_marquee=document.ns_marquee.document.ns_marquee2& U) o5 Y" [) V  s( D4 Y
ns_marquee.left=marqueewidth+8
4 o1 q. m0 o. }/ K6 ?; J' K7 k( ?+ ^ns_marquee.document.write(marqueecontent)
9 [9 w9 `7 v; ]6 R+ kns_marquee.document.close(). M& F1 ?' c, B1 j
actualwidth=ns_marquee.document.width  |3 g- X. i& J: A
}2 \/ _7 Q! R) e9 m  n# Y) S
lefttime=setInterval("scrollmarquee()",20)0 k7 l' x5 ]. ?8 u$ l: T$ _; \
}0 q$ k: a7 s) ]* w! `9 N
window.onload=populate
9 j7 g" `! W) h) y, {4 s- @" L6 b6 ?, k7 L
function scrollmarquee(){- j+ H/ e. I+ E( z
if (iedom){+ y' Y3 L8 k+ V$ j$ C( ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 }9 V; o1 r9 n5 j8 ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* M2 `9 \% p3 F
else, G4 P" l! w' D0 H
cross_marquee.style.left=marqueewidth+8
, L+ y; z; n7 @& s! f) u" r  h1 _5 A: n5 N, L
}
, ^' }  C! I7 p( m7 r1 belse if (document.layers){
+ J, y' G0 P7 z4 \0 F6 Qif (ns_marquee.left>(actualwidth*(-1)+8))
' E! r0 {8 y0 F: g& T5 w& Zns_marquee.left-=copyspeed1 [' o) K, S" T& l' \6 }
else
# A6 W3 X% V- q$ Q0 ~4 p3 qns_marquee.left=marqueewidth+8; X5 @( h: \& [. u" y
}+ G- |3 y# o# Z  b
}
) j- u- H: Q& ]# l6 _- u  ?6 x  U$ E! m% q1 |0 |8 O1 K) }( N2 R
if (iedom||document.layers){7 x; G$ M1 c- o* `
with (document){
7 |8 }+ B* _5 t, Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 {. I" h! B: D
if (iedom){
4 H6 A- L, d& P/ H! x6 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 R  T( N5 |6 i' d( w( N! J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* W* l6 {& N1 Y/ B# n' @0 J. k+ Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, J$ k9 u1 v) q% ?6 s6 L/ C0 hwrite('</div>')
+ G# l$ A5 [9 m* X. a}
8 x" c& E  g8 }9 p1 q; ^else if (document.layers){
; W, Q/ @* F7 |% ^- c8 S0 bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& j/ d7 y, [2 t; T/ \+ a* v4 ^- D$ [* j; f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' x% U- B2 ^- ?( d/ L& C, x* Qwrite('</ilayer>')
) u1 P7 U4 o9 S2 z' J}
7 T5 i( P2 \: l( E1 _document.write('</td></table>'): x( s6 {5 v- T& c" s6 w
}
9 s8 K! ^; D& T6 C* {5 O}
' V6 G' Y4 p3 [1 b8 N# }8 l</script>

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