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

|
网页之跑马灯文字特效
//修改宽度
3 G3 l. z1 ` m5 y7 zvar marqueewidth=300) P8 a a+ p: c6 E4 p6 Y0 a* o2 z
//高度
4 Y$ n' n- [5 b, d# f) Mvar marqueeheight=25
9 s: y% {4 t/ F5 G" l% x1 E' y4 e//速度(1-10)/ ]9 K j/ _% F! i; N5 [& H) L7 c
var marqueespeed=3( j8 X# {3 O- I3 W
//背景颜色
+ U$ {( k" d, ^# Qvar marqueebgcolor="#FFFFFF"* K, C, h( z: B, J
//是否能暂停 (0=no. 1=yes)?
5 g2 A4 c! Q2 J$ n$ yvar pauseit=12 E8 j l) E# i5 {
! L0 o" V$ a% f. F6 K//修改显示内容
* g9 ]: D9 K+ S( Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') V7 W! h5 ^( J2 L2 P6 }% ?
' `( n/ A, ]. Z7 S7 l+ h. ~
+ Q" N/ h( {( O. B- w+ w. u
////下面不需改变////////////
+ h8 _* z3 F' V( s+ s) V
' C( y0 w: D7 a+ Q- ?9 m0 vvar copyspeed=marqueespeed2 X* f4 n5 J( f8 Q
var pausespeed=(pauseit==0)? copyspeed: 0/ G1 j( e7 o6 _8 U" b( t# ~+ n
var iedom=document.all||document.getElementById
4 m [. J- N; `/ e, eif (iedom)
& t7 ^" A3 h: l. r( M- ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 Z" n2 j. Q9 k: mvar actualwidth=''
) E4 o4 i# }, L2 C& a' {var cross_marquee, ns_marquee
" ^; \6 c* { A& F8 {4 P. ^
0 h S/ d2 O% ?' D) Vfunction populate(){0 g, h5 I, _& x" }! x" U
if (iedom){0 m/ @! `3 g* ^1 O0 ~/ p$ E" q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. w' \) x Y: o' U, g
cross_marquee.style.left=marqueewidth+85 T Y" G$ t1 _: q! R
cross_marquee.innerHTML=marqueecontent: ? z' l( ^0 o; H/ t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ {: U( ^) D$ H, R
}! q2 T# p! H" A6 z+ f% N7 c5 y
else if (document.layers){
& v& L/ ?* v! Q8 l8 vns_marquee=document.ns_marquee.document.ns_marquee2
4 @0 V4 r% V1 I# i5 rns_marquee.left=marqueewidth+8
" ]0 v E4 {8 ~; R& xns_marquee.document.write(marqueecontent)- i3 o/ }5 H5 @1 C& u3 O/ j+ G
ns_marquee.document.close()
* D6 @$ {6 }% I+ E3 Tactualwidth=ns_marquee.document.width
* y* _3 a& u* V}4 b6 D+ I$ k3 {
lefttime=setInterval("scrollmarquee()",20)0 m( v. p+ x1 ?0 p
}
& \( X) O" j% g* t$ |8 ]window.onload=populate( u7 W z, A9 O/ I8 v
4 E0 [& ~' \# jfunction scrollmarquee(){
5 X7 p0 p) J; d) G" K- v. o- Oif (iedom){
/ w8 Y) Y R/ C8 B1 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 J' d1 g% E% W# Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( Z/ T% E7 \7 D7 U/ r) c a
else
2 ~* p7 E$ C7 z/ Icross_marquee.style.left=marqueewidth+8
% b# v" f4 {( J, J& |+ |
9 [& d; d2 Q1 ~( O [& _4 y}0 g# { P' H3 j) a- q. [. v
else if (document.layers){( \5 N+ x- I6 p' z2 e
if (ns_marquee.left>(actualwidth*(-1)+8))
4 Q6 |2 ?! h7 p9 x* Q9 Ans_marquee.left-=copyspeed
( O# R, s* |& m; W0 j& ]3 jelse8 @/ B, f7 ~ R, l. d0 e* z7 ?
ns_marquee.left=marqueewidth+8' @3 R8 y1 w/ x/ p( c7 [7 C
}
( R5 `. a' g# d/ L+ d) r: X& x}
, d7 U& Q2 p1 c' W
+ O0 E# U( ]1 F( H( @if (iedom||document.layers){. c- t$ H$ }! C+ w
with (document){' K$ ]4 T( }/ W3 g' J! E1 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( G5 F. Q, J- P7 Z0 A
if (iedom){
9 s" Z: S% L1 c. h+ x/ W3 v0 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# v. w. t5 |' v t: S8 b- t' mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ D: a0 y. q! H/ M; _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 p0 A/ d6 p9 f0 r
write('</div>')
# v7 [1 C# u; i, ] n}' M- ?4 U* K6 g5 i! ?* z
else if (document.layers){
0 @" J6 Z! n- T; s6 T+ N/ g& X7 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 Q+ x0 v$ ~4 i0 r) X- b! V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 U! x) w8 [* e6 i& }; }write('</ilayer>')
( B# S5 h% m6 D0 B}. |% H# k& d4 d
document.write('</td></table>')
8 @5 C0 n9 l8 U7 A5 O. C& b* o& f}8 [0 @2 m7 J( ~( h4 \4 L$ O: i$ \
}
; {9 ]7 r' \0 w% u' ^</script> |
|