返回列表 发帖

网页之跑马灯文字特效

//修改宽度% T; b( o6 S, d" L8 J% J2 [
var marqueewidth=300
/ O- I+ g8 I& r; K6 X//高度' v9 h& ^% k6 `7 l2 e; z+ g
var marqueeheight=25, Y4 Q  |7 {6 w0 D8 [5 Y
//速度(1-10)1 [' J, |% p7 s- S+ F2 Q
var marqueespeed=3
9 {- F, b, V0 [: E' v# o9 y1 {4 x//背景颜色
) M0 l4 Z' J  X$ f- G; bvar marqueebgcolor="#FFFFFF"3 z' ^: l" S% C- |& G/ o
//是否能暂停 (0=no. 1=yes)?
) X6 s/ N! h0 R- n+ N2 qvar pauseit=1% C- t* w6 P) U: p

' N* c$ ?' S' @( i; J//修改显示内容  w7 ^' F3 D2 I5 f. w3 n- Q5 |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. [) c" h/ n2 a; }8 l
9 T+ p$ a6 n$ V6 J* x! ]/ n, j3 ~* o; Z
////下面不需改变////////////& y9 {  D/ O0 M- y% O

* @; `$ W+ |5 e5 Q. s3 s* Kvar copyspeed=marqueespeed4 E+ h. }% e8 _0 [; D- u' I
var pausespeed=(pauseit==0)? copyspeed: 0
- ~* G) f4 C7 h; L4 Cvar iedom=document.all||document.getElementById7 }5 p$ g! ?) I  |% C
if (iedom)
9 R( I  E& @( Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 ~: Y5 @" m; z4 V7 ]# ^
var actualwidth=''% _$ @- E/ y  ^2 q( ]. l' e6 G
var cross_marquee, ns_marquee
; W0 n- z1 m4 x* f+ L; v. O7 k- `  G! ^$ W% J6 r
function populate(){
% O' F% ?+ @- V' l  H" d/ Eif (iedom){
4 d+ ?! ^8 P: scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 I; ]$ g) b1 ^; k1 M! ~: tcross_marquee.style.left=marqueewidth+8; V$ |3 G7 |2 q
cross_marquee.innerHTML=marqueecontent) ~/ O7 {* ~: n. z6 o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' K8 G( s3 ~, K
}, u( V/ s( p: d( g. l$ h9 E9 M0 f2 {
else if (document.layers){/ x  h: t- |2 X2 i
ns_marquee=document.ns_marquee.document.ns_marquee26 [; m+ Z; z- `8 b4 U! B
ns_marquee.left=marqueewidth+8
3 `  ?- W8 |2 _* Y. kns_marquee.document.write(marqueecontent)
7 |; X- W" L" r. rns_marquee.document.close()9 K) k" S# I5 K4 @) l
actualwidth=ns_marquee.document.width
. e6 ]$ u5 j) ?: Q}( {! l. u% G% i' K* C$ Z
lefttime=setInterval("scrollmarquee()",20)
/ E; {8 i8 A, O9 s' a}) K% y6 ]( D: b* i' f+ N- s
window.onload=populate
: r4 o. ]( Z+ O: M8 S/ F- o) o; G
$ f( m; T% O2 z7 T6 |0 ffunction scrollmarquee(){
8 {" D2 e7 m: a& q* d. }. uif (iedom){0 w4 B+ }  x% O9 A- n5 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( @$ U- x) `3 ^8 F1 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 k% V) b( D9 H4 |  z
else
5 M) O. G* a0 q7 @* v. Ecross_marquee.style.left=marqueewidth+8
. C) F: ^! z- [0 f
* ?1 r7 q: p( j, }' F' z$ p" z}$ ^; h; g+ E7 ~1 @& d8 M  g
else if (document.layers){
+ j: ^  p8 ~  d$ V1 U; oif (ns_marquee.left>(actualwidth*(-1)+8))# I, i, k. `0 P) f" e. f, N; a
ns_marquee.left-=copyspeed
$ e$ Z3 ]+ O3 B2 B1 S3 Jelse
4 m: `, H4 g  j+ Bns_marquee.left=marqueewidth+8# `4 {! s! W$ d8 T* x
}: n6 x- G# e! o0 B, F5 n! C
}# s& L) H" f8 w6 R- q/ d+ u
4 l; P8 k: K  u1 N3 i% f$ r1 F
if (iedom||document.layers){! k8 c3 @" M) c7 u9 s1 t
with (document){1 |, i- f. n* c' j8 s; x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' V- M  K9 J: q( k( {: [
if (iedom){. o. F6 S2 F2 I. a( [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 U/ W) ]( O0 h' d: E/ |% |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) l. X5 Y8 A4 g" Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) c5 A2 w/ p$ Z. F# k+ L3 J0 ]write('</div>')! e/ v9 B, d, J! I, n5 {
}
( e% T. i1 f) y' G1 |else if (document.layers){
# J1 m7 \  W* ?1 x: W' b2 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' C+ a( u! y: H8 X* f2 ]3 hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 J5 F0 k# T" P) T4 E  v+ Ewrite('</ilayer>')
& ]4 h& y* Z7 k2 K, q8 Q( h}
  w! q% ?1 a' {9 Y( `* s- Ndocument.write('</td></table>')
% K5 @/ I4 g' H: r}/ C6 D4 s9 |1 I+ s- w  }+ c+ N
}
! c$ ?* G& N" Y# i</script>

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