|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
# B2 j+ r0 E* o- I8 P* }. Ovar marqueewidth=300: v! e7 Y& w5 F
//高度( U# _. f# e; v1 m7 n. ?
var marqueeheight=250 b/ }) b; P3 f- |& F+ U
//速度(1-10)
/ k, q F$ }' lvar marqueespeed=3/ ]) K v! _. Y7 { L- ~
//背景颜色
8 j( g( R! f5 x2 f+ ]# K" x1 j# kvar marqueebgcolor="#FFFFFF"9 c9 {% U2 ]& L9 F
//是否能暂停 (0=no. 1=yes)?, a ?" j) v8 y- m/ ?& B. Y- X+ Y
var pauseit=1
1 T( o% ~/ {& X0 y7 K* t
' L i0 n6 }# r0 E* s1 T//修改显示内容7 e7 F' O, k; d$ N3 |! X9 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 c; O' h* ~! ~7 t! X- O4 {( G* Q/ m
/ M; T5 u: i4 y1 g/ X
////下面不需改变////////////
& ~& U! y j5 V( l0 m n* f
) F J% m7 y; K5 j4 j/ _var copyspeed=marqueespeed
, o$ A' o# u6 R4 z$ Xvar pausespeed=(pauseit==0)? copyspeed: 0$ n7 ~8 g9 U. P( z: [
var iedom=document.all||document.getElementById. D+ q; \8 J* y% r
if (iedom)! P! d) N1 N7 {: U& j' t' O. |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, w/ d' ~% {# i4 d$ uvar actualwidth=''
7 W+ p' I& R ^$ Ivar cross_marquee, ns_marquee }$ E& Q1 x% |. @1 R
" P4 n8 g$ R' D- C- I( X6 F" c r
function populate(){
- f+ ?8 v$ G8 x1 Jif (iedom){. A8 F! V# W& T8 R/ w, ~, p0 u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' ?6 c% |' ~8 b' `4 }
cross_marquee.style.left=marqueewidth+8$ r! Y% X, ~- \/ ?# J; G: A3 ]
cross_marquee.innerHTML=marqueecontent. H0 ?! q5 C9 @! q. H. K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% q9 B- v1 ^% t) A5 ^8 |3 m1 B" b
}
. L9 \" X4 y6 D/ Q' C1 n. e, uelse if (document.layers){5 b8 n+ z- \" ]5 |% L Z: d6 j7 c8 Y
ns_marquee=document.ns_marquee.document.ns_marquee21 P/ p7 `$ `0 |- k- E, E( d# |
ns_marquee.left=marqueewidth+8
: _- u. Y! j! B! P" s- F$ a+ ans_marquee.document.write(marqueecontent)
( \0 I& k8 n6 L2 V7 _: w' ins_marquee.document.close()
" I4 [* [3 s# F( g( Nactualwidth=ns_marquee.document.width7 A# B7 J! L; _$ |) p& a
}* M u! ~9 `# A1 R* ]% l* T& Q
lefttime=setInterval("scrollmarquee()",20)
+ T' a Q! S. Y- V}
& D3 \' O) Q1 b Jwindow.onload=populate
* F3 t, O, E5 ]. H' A
4 a. p2 V: ]" Vfunction scrollmarquee(){$ R; K! ]( Z' C. p: T0 J
if (iedom){' e5 z, o% e+ F) H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! w+ }7 L# w3 N! L. M* zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# p5 H. i8 J! M! v( N
else1 B q8 E9 o' {2 p) e' Y
cross_marquee.style.left=marqueewidth+8
0 U. Z. j' L6 `" c& W1 |8 b( k2 R5 t+ G j( b/ _5 ^
}/ o! y; ?9 ?: a9 A
else if (document.layers){- w |' j* c3 d/ Q% l; {
if (ns_marquee.left>(actualwidth*(-1)+8)), q- N1 Q# F' R$ @. @$ u1 j
ns_marquee.left-=copyspeed
' \: o5 O+ T( x+ Oelse4 k7 \0 h5 E- w3 l* j- ^4 ~" r
ns_marquee.left=marqueewidth+8' N" c. D, k1 k7 `$ w! _) O
}3 |6 p Z3 e+ a' ^% }
}
6 v' m5 W/ N4 Y7 A6 M$ }: y; n# Q" k# T% B8 x0 T G |0 h# D
if (iedom||document.layers){5 _; q9 @2 b4 I8 g5 E- G" b! D3 c
with (document){
% I. g8 a0 s! P# kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 @9 H! i+ G* ?! kif (iedom){
: R' X/ H( o2 |/ _ \4 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 q3 |& c+ {* I( |0 ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 ^2 I$ O: F9 M+ @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 A$ b% @" V- e. \$ E" O- K: v
write('</div>')7 ~% u! g- \) W- _3 z) Y
}' c+ @0 H/ c# ~- w \* o, d) u2 Z
else if (document.layers){
) c2 M7 t. u6 S: Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ |$ f& a' n! D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): C& N* ]9 w+ T# s' L
write('</ilayer>'): [" t8 } I/ N0 h& f/ t
}
# h) n9 }# }& v5 C) i8 O6 ddocument.write('</td></table>')
% G2 i1 g) I( C, {( T% Y3 L" R8 L}
% G# z9 g8 ^: `* d' M6 j! [3 E}8 D" o: G- p# S: q* y/ T
</script> |
|