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

|
网页之跑马灯文字特效
//修改宽度
3 O- Y, l6 P$ {8 i. O9 p( ~var marqueewidth=300( U. X% J6 h* m& A9 b) R$ F0 r
//高度
2 U$ j* w! l6 B) U \* R4 @var marqueeheight=25
' O7 [' W; {- I+ M% W- n//速度(1-10)
# z* @- O: C! m: Hvar marqueespeed=3
$ j; }! _ g# j. e% k6 D//背景颜色
4 `6 R6 ?) W& r% f8 b, b& mvar marqueebgcolor="#FFFFFF"0 y* _2 E% ]9 q$ W& Z
//是否能暂停 (0=no. 1=yes)?3 k' M$ ^9 S1 b- u) b
var pauseit=1" a$ A" |9 z+ F. K5 g. z9 V
: N$ O4 k* J! V) a6 O7 G0 ]& f
//修改显示内容
$ \; D% F0 @. f/ Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 \( R0 P' s' k- f# m( e; G3 k
3 ?, ]3 W* @: ^" c4 F# `% H- T2 A6 T
////下面不需改变////////////6 L9 i. S8 E6 H, R1 X
D" K) h6 I, I2 R8 }var copyspeed=marqueespeed- T2 A( b0 s7 o7 y
var pausespeed=(pauseit==0)? copyspeed: 0
/ E: J4 q; N5 N& ~# i2 Qvar iedom=document.all||document.getElementById- i$ z0 M: e; B" t- i2 E) X
if (iedom)! m w( o# t. F }( A6 F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); j% {6 Y2 ]! g) n2 C( ~
var actualwidth='') ~/ Y" J5 _: H: ]& H0 B- b( d
var cross_marquee, ns_marquee
! i: ?$ X" o( M6 K6 Z; H0 o1 @% _1 g. s% p+ v
function populate(){
5 y2 j! L8 d6 b* xif (iedom){
/ |: i+ K4 A1 N- }2 Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( l) _( s0 M: W. L H$ [cross_marquee.style.left=marqueewidth+8
F% v# Z# Y0 @/ n7 p( P1 Hcross_marquee.innerHTML=marqueecontent
" i; Q8 u' Z) |) Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% _, m1 z+ H" s! r6 I; {8 ~9 P1 N( `. `}
7 h, k: P0 q; p% |; ~1 helse if (document.layers){
8 W0 P) I9 d9 r9 P. N D3 R: n9 @ns_marquee=document.ns_marquee.document.ns_marquee21 B/ D; c: W9 A5 f& x3 F
ns_marquee.left=marqueewidth+8
4 [% R9 T* K. t) U; _) rns_marquee.document.write(marqueecontent)
: `9 e( `& [+ w: U" S* K dns_marquee.document.close()/ q; Y, H$ W- {* F9 o
actualwidth=ns_marquee.document.width/ N8 ~2 j- B* T5 U# ^; Y3 G
}1 v+ ` l7 ?" k. o) ~; `( H
lefttime=setInterval("scrollmarquee()",20)
% k& g: N7 w+ I( M& O}
! G* J- \- H" F& Nwindow.onload=populate) K2 K1 v# T n, ~. O
# R! D( q2 N& T; r( B
function scrollmarquee(){2 u2 j' O8 k; A0 d F/ A& z
if (iedom){2 Y# l% A1 }' O. A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% s' n5 o7 T7 s; _3 c. }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* G0 Y* j; o* {2 qelse
7 O' w p( ^( j9 y/ A9 dcross_marquee.style.left=marqueewidth+86 M B: m0 ?. P w: n" e
) x3 ]6 j; n% U. f, l
}
0 Q% d0 a s% U# E! y% g4 X, Velse if (document.layers){8 n3 m& b7 [" `. |6 l
if (ns_marquee.left>(actualwidth*(-1)+8))
9 y0 g3 z- P1 Pns_marquee.left-=copyspeed
' B! y# J6 b2 v8 qelse
! q: P2 a2 f) }2 K0 U. Nns_marquee.left=marqueewidth+8! }! J! E7 Z: ?
}% U" X- q( Z. p' N- v2 n
}9 s2 F N# }; B" D8 B; h
1 j0 g' P$ O& i" bif (iedom||document.layers){' B5 ^) i" a" f$ c
with (document){: k+ [* s/ I# s' I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& S+ T8 G+ D, Rif (iedom){
- ^6 w; I0 `" W7 `% `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ ?6 ^' X1 R8 L0 V! x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! f9 X" H. P: l- N: O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 e7 s. h' v' z: Awrite('</div>')
% x) u | i1 K/ R! w}
% j) l5 I( x0 E3 f. Y0 n! belse if (document.layers){0 z1 M! p, R! N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
t9 z' ^# L) Q$ B9 i- h; C" awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 i6 u' Y6 y" Q* Q& y2 Ewrite('</ilayer>')
" r8 |* [5 ? Z2 z" G7 n}
# p, z- L. e) `2 \2 O1 y# z0 \document.write('</td></table>')
6 j" Y5 J- x, N: a% z" p}
0 K4 C# |% p* [! V7 q+ ^}0 B7 f7 n, n) {7 a( z2 O5 y: c @9 G- s
</script> |
|