返回列表 发帖

网页之跑马灯文字特效

//修改宽度* E! ?/ z2 d6 x; Y0 q
var marqueewidth=3002 K' ?( T) s! i! U( F( x4 g0 c. m
//高度6 {* t3 M; _3 K! l# y9 F
var marqueeheight=25; i1 |0 B/ c" B1 c2 }- J; w6 h
//速度(1-10)
5 }- a+ S, H7 n! S) Wvar marqueespeed=3- m+ Q* ~) s" `) l6 R* f1 ?8 r
//背景颜色
. V7 b2 x5 s0 |, F( B7 m6 A( g3 wvar marqueebgcolor="#FFFFFF": _/ E9 M1 I8 l( R
//是否能暂停 (0=no. 1=yes)?
# x( _4 r' w$ P0 Y6 `( {0 \var pauseit=1
" K7 Z5 Y* m6 V5 I8 I0 y+ ~, \6 \) T( ^( ?! W& o! i* W6 M* h
//修改显示内容4 ^! ~) t5 p3 N( h  F1 D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. {! J  a/ n* I, B) r
  l8 Q4 H9 w  b+ p+ d7 m( |
3 \, S9 u. X% o2 O7 {  H6 F* w7 T% E
////下面不需改变////////////9 H+ t; S& h5 A0 i" G% W

+ ?5 M! c* a) D0 T2 Cvar copyspeed=marqueespeed+ Q3 t: R* v% I; k
var pausespeed=(pauseit==0)? copyspeed: 0: n2 |) p& @8 j: D2 A+ Z
var iedom=document.all||document.getElementById% s* F0 i) i3 M- i1 k& g
if (iedom)  i( J8 i! }6 Z' ~9 L( y  x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 S2 r  T, E: p- R" G1 ^
var actualwidth=''
& B! m3 Q) `* t$ x' mvar cross_marquee, ns_marquee0 x0 ]8 _0 i* U. x
4 F) }& l4 \* F7 m# q
function populate(){/ A2 C7 U: j/ s: M
if (iedom){
$ D1 N; v, G: f% ^% lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 v9 |: m9 n7 }4 Ycross_marquee.style.left=marqueewidth+8
6 m7 }$ r. z" h$ W- `cross_marquee.innerHTML=marqueecontent
  M2 h; R& C  v( K# I5 Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 H' A/ o/ ]9 e3 Q, S}
7 V2 _2 i. q8 W0 x; ]. Z% ^else if (document.layers){6 O4 u8 q( g. h3 z4 l/ `, W
ns_marquee=document.ns_marquee.document.ns_marquee2
& M" `! w* Y  Q& ?$ Qns_marquee.left=marqueewidth+8
, X5 ?. H  P7 |ns_marquee.document.write(marqueecontent)5 _4 b. p1 }; e
ns_marquee.document.close()% t# Z2 r. |  w! a) J
actualwidth=ns_marquee.document.width
( ^4 ?+ K& L  h" G  F* f# }}
! L+ m/ M# }5 `. |; Mlefttime=setInterval("scrollmarquee()",20)
# a" A' {$ m* q+ e}1 z7 ^0 x7 x- W& L/ G  o" P
window.onload=populate
& F2 u+ o" p% m) z1 r2 T3 \( R% d. a, I+ g6 l5 @( j- T: ]" ]
function scrollmarquee(){
2 |* T+ S  b4 r7 `6 E7 ~5 eif (iedom){/ y8 ~  h+ e" T6 _  i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, H4 }! ~$ |* G7 l- j6 y1 m- o( lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 G  w7 e+ t6 c$ Telse
% W$ p0 F9 |+ [- qcross_marquee.style.left=marqueewidth+8& L; {1 O: T% M6 M/ ~  \
0 B/ q! |7 S0 [# q  U# ?7 w
}
) W3 m$ J: U9 Lelse if (document.layers){
4 ?; u7 ~% y# j3 z& \if (ns_marquee.left>(actualwidth*(-1)+8))
6 ~& D/ ~. z! a% ~' Y) k7 O5 z4 Yns_marquee.left-=copyspeed, r, B* ^' r7 f/ m# e
else6 W) O8 Y( D8 [7 N! o
ns_marquee.left=marqueewidth+82 `" M( @4 H4 Q( F/ B' F6 ]% g
}* I2 C9 I$ s6 D( B8 W7 e
}! T# ?6 N0 @3 k8 ]
. n8 o. L' d% [  q3 e1 z% o
if (iedom||document.layers){
( ?' v% X/ Z" k8 w3 ]6 |; rwith (document){& N7 |. `+ Q  G. j4 H( r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, W% s% {# ]9 d' t8 Tif (iedom){
) K' c( N3 h, L% Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" b0 T% K, {/ y9 x, Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 e8 t, q: W  j& t' L9 o) q+ W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 r) W- _$ S$ X! ?
write('</div>')
2 G4 r1 E) ~% m  C}) F8 _8 l. T0 Y( b0 i/ Q
else if (document.layers){0 k) u0 H5 ?! L; s: l* N; l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 n2 p6 w* ~. u0 ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! l% y0 p7 D3 }, d# T8 V+ twrite('</ilayer>')7 s9 v2 @: F+ ]$ B7 {6 g
}
1 _( l/ P5 G7 L& zdocument.write('</td></table>')" T% h/ v0 A& i9 C% Q9 U9 g
}* m  f3 a* n2 Y# Q1 t
}3 _& `" _" X$ _, x0 W% E
</script>

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