返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- k1 t- H" E* L. M4 o9 }var marqueewidth=3006 |6 E9 M1 B" Y% x9 s5 u+ k
//高度
5 P8 B7 v* ^. j+ a# [" ^var marqueeheight=25% m" U' D0 z2 m& g- j5 t. L3 g4 z8 X
//速度(1-10)  u0 m7 [. [0 Z: \& p# h3 y
var marqueespeed=3. |# }3 d5 w( O; M/ w
//背景颜色
  J' U, ]9 r, t3 rvar marqueebgcolor="#FFFFFF"
9 |, Y$ ]7 K( t//是否能暂停 (0=no. 1=yes)?, k- S) I0 n6 V. x
var pauseit=1, F  i& Z$ t: j6 |' N
: d7 S, ~6 [$ O1 T: n
//修改显示内容  N( y) }9 s+ k8 r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( M  u6 t0 }% T! u2 S
( M6 q0 g1 k9 T# m: b; G' W. [) ]
" m8 e* W) G" `////下面不需改变////////////
( e% L  F9 [7 t* ]5 o
8 e: ~( _5 P4 B, n* F) K- tvar copyspeed=marqueespeed+ G' @* H: X4 S' R( E
var pausespeed=(pauseit==0)? copyspeed: 0
- G' t: X6 S3 U( L1 i- Lvar iedom=document.all||document.getElementById1 w6 H( `5 q# L" b
if (iedom)
; l" [6 @* q: r) `$ C- j  sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, p5 q: u4 k! X- z6 Pvar actualwidth=''
" ^8 O0 b! l+ \4 cvar cross_marquee, ns_marquee
+ F$ ~" s# n) I6 Q4 S! S; n7 j& Q9 c4 _3 J) |
function populate(){
2 f/ ]4 j8 ^0 L! z" dif (iedom){
3 {" Q. u- a  Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 L8 d. n) Z: P. v+ C! D  Ocross_marquee.style.left=marqueewidth+8
" u8 S$ B, ~4 {& b& r/ ocross_marquee.innerHTML=marqueecontent
! ]: j- D+ _* }, v1 Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 o$ }, P8 u0 z3 f}4 t# Y& ]; p: P
else if (document.layers){: j" D7 U% ?" _( |( p7 ~8 o
ns_marquee=document.ns_marquee.document.ns_marquee22 {4 P8 z. v0 ^' i. X) t
ns_marquee.left=marqueewidth+83 i/ _- H( h% n7 r
ns_marquee.document.write(marqueecontent), `9 F# `; l5 W6 k, b+ Y: t0 X
ns_marquee.document.close()# A5 `: z/ }; o+ l
actualwidth=ns_marquee.document.width9 r9 ^4 K0 n* \: i/ W
}* m" |# W" X" k6 @# i
lefttime=setInterval("scrollmarquee()",20); G! C  H. B6 l# Y( U9 d$ e
}6 @5 i/ U. m4 p' K
window.onload=populate3 ]2 D6 q' E- e+ U2 F+ D

2 T1 D7 u" C, L( k" P1 z' Q4 H6 cfunction scrollmarquee(){7 d# b$ O7 S0 z2 B8 M- }8 ]% z
if (iedom){
+ P- E: f( @' n% l" `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 k: W- D- U$ \8 \  l' g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& U$ Q! {+ Q( d' b0 @- p6 K
else
/ }6 z& Z. s( N) a7 ?, w2 m8 ^& fcross_marquee.style.left=marqueewidth+8
8 Q& {. _- Y4 |) ]" q+ l+ I- g$ A3 ]( Y1 ?( G+ `, @8 w, k* R
}
  |$ I+ w/ q; N. C9 q9 x; A( relse if (document.layers){: c; Z! O! a  c; V$ i( K: M* y
if (ns_marquee.left>(actualwidth*(-1)+8))- _- q/ `4 p; q  N# S' Y; W' J
ns_marquee.left-=copyspeed
) n0 i0 l4 x9 v% d+ B8 J4 R  Velse
1 H3 m; D& v& y) pns_marquee.left=marqueewidth+8
: V* _( W$ H: b# j3 n4 D}
- p: A7 P7 N; B2 e, T}, \, k$ D1 |# e
/ G( J  S1 i4 h6 O* Q1 ~2 }
if (iedom||document.layers){
7 M; K8 H2 D& r6 S$ P/ ?7 swith (document){% ~7 I2 k) U  U3 I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 y2 v, }7 v- f+ F; n# `- b) T  I
if (iedom){( O. W3 p1 e. J1 X6 @9 h6 i7 r) L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ p( K( s1 @0 g/ b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): r9 _/ X5 |& K! P$ d  P7 E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) m7 y8 N$ A8 v. }
write('</div>')* q& u8 l( D* ]1 a/ c
}
1 A! X- [. q( \; i  xelse if (document.layers){: e" b4 U/ P) {8 X, V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" j+ |$ J8 t7 }; Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, A% U" ]/ X+ ^/ z9 Pwrite('</ilayer>')
, I$ C1 Y1 M0 U" `}
- u  p: I3 Z& N3 ndocument.write('</td></table>')
1 n5 b' |% r6 P* [}+ d" a6 o) K/ e% \0 Z& u
}  L; I- D' E; f/ H4 |
</script>

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