返回列表 发帖

网页之跑马灯文字特效

//修改宽度: d/ m( ]; D8 d9 b4 a# M1 Q
var marqueewidth=300- c5 k# [+ S# G6 x; c
//高度/ K* j! _! x; Z* F, X% u
var marqueeheight=25: d$ }3 x+ ~3 T! m) M
//速度(1-10)% }$ J4 Z+ @3 v' Q
var marqueespeed=3+ l- m0 p- X8 O8 b+ J6 i9 r
//背景颜色
6 ]! x0 g) F1 i4 v9 Y0 Cvar marqueebgcolor="#FFFFFF"' a6 q2 \" {4 ~+ g5 J7 t
//是否能暂停 (0=no. 1=yes)?# s- p* O1 ]. N6 l3 @
var pauseit=1
0 ~* A* I$ Z- S  v8 w
$ B8 T' o# C1 @//修改显示内容7 L* h7 _7 Z# h  _4 _; @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( U. v- _# ^$ x% A7 M' x% g2 r) l) a/ a; R- `
0 Z# l2 u) I7 c
////下面不需改变////////////7 K5 t" a# E3 R" S' U4 V' P0 @
6 N9 S2 o9 z5 |' u; w2 {
var copyspeed=marqueespeed3 @0 e$ ?6 k0 W' l9 K! ^( r% y
var pausespeed=(pauseit==0)? copyspeed: 0
7 r" I; L7 h, ?  N! B1 Q, Ovar iedom=document.all||document.getElementById
0 k- T; d6 N* k# aif (iedom)
5 V/ {$ _9 c( p6 w; Y/ @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 e& O( U- w) M  a0 I& {, k
var actualwidth=''+ T" ]4 j; _0 F/ ?
var cross_marquee, ns_marquee
9 D- h+ ~7 ~' }4 `" j: d5 V! T7 D$ I3 F) W
function populate(){
5 L8 {, m6 h# @) q6 |* Qif (iedom){
: X& J7 Q- @$ E- Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) w* b; ^; U+ ncross_marquee.style.left=marqueewidth+8
3 j2 I3 A& j% ucross_marquee.innerHTML=marqueecontent" K' m8 o0 V, I- m6 Z. |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 o! B6 k5 U. e* n  `}, @" s% n4 E9 S. _6 `6 a0 u5 d5 z$ S
else if (document.layers){
  U6 i& v8 A4 P4 cns_marquee=document.ns_marquee.document.ns_marquee2
* l. M3 n2 Y& l2 Mns_marquee.left=marqueewidth+8
& Y, a9 n1 T3 K4 l% `! Hns_marquee.document.write(marqueecontent)
  p' t9 c8 h1 O4 h8 cns_marquee.document.close()
2 U& l7 c9 f# @8 aactualwidth=ns_marquee.document.width
9 P* V! o- Z- f+ {# g' V}) L7 J# \% ?/ m. V9 M
lefttime=setInterval("scrollmarquee()",20)# j/ Q( c2 X  ?; }  @
}8 A" p2 q% _2 B9 @2 N  U
window.onload=populate+ k% E+ x" i# N9 x' y: E

! B7 d0 a& j4 G- U" b" f5 ofunction scrollmarquee(){8 a1 S& Y  d. j1 z5 ~4 f
if (iedom){! C0 V6 t* L, i2 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! {7 i9 w; E7 d" Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 s$ K# f6 \! S) W
else
' z$ ^8 i9 k' o. e$ z7 \7 i. Y- |/ rcross_marquee.style.left=marqueewidth+8
1 Y9 V; k; w8 S6 w) M; b4 O) E  }( c, g
}) V0 m3 |% Y! _1 m( s  X
else if (document.layers){
+ z$ _" i5 N/ @; Sif (ns_marquee.left>(actualwidth*(-1)+8))' U! G- @7 ~$ ?8 D& [) J$ S
ns_marquee.left-=copyspeed8 w; G3 O! W: C# E$ Y  }
else
) O7 U8 w0 o; P4 }0 ~ns_marquee.left=marqueewidth+8* l! D, ~* o( R
}" @/ \" U& Q$ @/ h' }9 ~" L; q* S
}& s& T) \$ p1 E2 E/ D4 m

7 `% ~. t  [9 P* A) I# @if (iedom||document.layers){
3 y* n& E/ R  O- C: R! nwith (document){6 F/ K" O$ X) |, n( t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 v- d  d) X0 Mif (iedom){
% b6 @: B5 `1 ?  R) L) Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ i# {6 B! y1 }9 U" O: `) _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ W# E. ?2 X1 O0 R4 A1 v! I' S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" p* A9 Z7 X/ j. k5 [$ B5 y  N$ m+ |3 swrite('</div>')1 }7 v& V3 ^* `% l% j
}
3 P, H& V4 k9 _* b% I1 R& ^1 x" d) Q. ?else if (document.layers){) W# W8 b) ?7 f9 [! \! ?2 p8 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& I$ V: Q! X; t2 W; }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' f! x2 Q$ H3 ^# N8 H0 ywrite('</ilayer>')& i- P  I" ?1 ?6 r
}7 J% _) ~2 k2 |. G; S2 b
document.write('</td></table>')3 Q( ]) B4 L; @( D! v
}
, u5 F! F+ q! [# W4 ~}
" e; V3 L5 ]2 x/ B$ ?- v</script>

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