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

|
网页之跑马灯文字特效
//修改宽度! j+ R& f$ v5 r, ^
var marqueewidth=300
: k* B; X/ f/ U//高度8 P$ R* Y# A3 W4 C' Q: s
var marqueeheight=25
) J" A$ g; _* p$ [* K; f3 j//速度(1-10) W8 W" O' W% d: @8 b& Z
var marqueespeed=3# a* ? X P) A. m3 v" r8 i# K
//背景颜色1 H l# i9 f' S: c. n7 W8 m8 U
var marqueebgcolor="#FFFFFF"
! N7 l* v6 E. j& R: }& ~; K, @! }//是否能暂停 (0=no. 1=yes)?$ V- v" M7 U7 J) U( ?4 x k
var pauseit=1; _8 c+ H7 @ L0 ]/ _+ t3 m
3 t% G% |0 z2 H- @- ?. l5 @//修改显示内容
) z" w7 \. Y3 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- K1 N% n }* ]3 n9 w" B8 c
/ z1 j+ \: B$ P$ Y& \1 U4 p @& N1 B7 O4 v g. v* X
////下面不需改变////////////
; [7 B! P! ^2 O5 w8 |( Z) f4 s. e1 i+ x* S6 _' y3 r
var copyspeed=marqueespeed
- |3 @' _% I6 C( t) z0 c4 n2 p, evar pausespeed=(pauseit==0)? copyspeed: 08 q) L& g! D; m( h2 ^- L
var iedom=document.all||document.getElementById- l& ^% {) N; P9 a5 j
if (iedom)2 @" P1 h. \; Z f$ B. Q3 B2 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" J+ A$ j0 V# }6 nvar actualwidth=''# J( _. e% a- W
var cross_marquee, ns_marquee4 r; {- y+ M3 u1 I$ M8 n
N0 B K( @6 l2 g6 s* m
function populate(){
5 N. C1 R+ d. W6 s. q- D3 bif (iedom){
' {# M1 V9 u* L9 x! P$ z! }0 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. C0 t( {, y8 S3 P
cross_marquee.style.left=marqueewidth+82 y0 Z2 I5 G; E2 e ~8 E* m
cross_marquee.innerHTML=marqueecontent" Z# U0 S1 t4 X8 q; y+ E3 N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 D% H. Z4 J% ^$ C1 V}, J. _( F: x+ P( H5 ~ `6 N c) h
else if (document.layers){
" t/ A- k& Z, n( dns_marquee=document.ns_marquee.document.ns_marquee2
1 r5 {$ E+ F, ?; ?+ | @4 G* Sns_marquee.left=marqueewidth+8
9 C( v1 `2 V; \6 p: T# ons_marquee.document.write(marqueecontent)6 M/ k/ b/ u' L3 B( b
ns_marquee.document.close(); A3 F# c8 }/ }6 h. m3 X5 j
actualwidth=ns_marquee.document.width
* q, e t- K2 f, r4 s+ m}% l) d* _6 P; |9 {# ?0 M# K
lefttime=setInterval("scrollmarquee()",20)
! i- V; p& P" U# ?}) A$ Q3 J2 U5 a/ B
window.onload=populate
" q" D8 u/ k7 X+ ^) H9 W+ v% R2 l, b" {
function scrollmarquee(){5 l6 w( {8 }0 t
if (iedom){
. u( V4 g) _# c" F6 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 A" d4 N3 e$ ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 C" K- v* O/ m
else$ r' G v4 D0 }7 l9 p
cross_marquee.style.left=marqueewidth+8
1 u9 u5 {3 i" @* `9 l V3 }6 i( E0 @* G# }4 j p+ o. I
}
' a2 {' o/ q/ R" P1 a0 Yelse if (document.layers){
% |! ? m9 J" k0 t& c& dif (ns_marquee.left>(actualwidth*(-1)+8))
4 z9 s7 d3 Y dns_marquee.left-=copyspeed
7 j) i; W: L; }9 H \( A+ gelse$ V& T* [# ~4 s2 N
ns_marquee.left=marqueewidth+85 J! p$ `) p' E* v% ^+ t
}
. O6 o, S8 ^4 {1 }7 T}
) ~5 d4 X* `) i& F' u' [/ a: s' |
3 x8 K3 ?* \3 o9 T& O2 _) e* R! ^if (iedom||document.layers){
- O8 d) }" x( V+ Twith (document){
) X! e) k" H% P2 M ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): k- o4 O/ ^& r2 H2 f) f
if (iedom){
3 x G( l6 X' @0 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 H4 M4 o; O, e1 @ C: _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 j% q/ R+ o1 C, _- ?, C* H2 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 D) v( p5 p Q% V; @
write('</div>')8 {7 N0 T7 k f" o
}$ L# d0 d. F$ R! e
else if (document.layers){
2 y! S; _' s5 h9 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 [0 ~1 _5 _6 G% _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). m, T) B7 h5 o, X; B+ h0 ?
write('</ilayer>')
6 A |1 e! ?) g _2 T} t" b; r0 l: @$ W! R! u
document.write('</td></table>')
- C. k( Z( i6 g' E8 k}3 J) H; b: G2 I! [. z
}' F9 _( x" m! W6 k5 V
</script> |
|