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

|
网页之跑马灯文字特效
//修改宽度2 D" ^7 ?- x& v
var marqueewidth=300
0 H% y7 f3 e- R! @; W//高度/ `7 Y- r; d) t! v
var marqueeheight=25
: j% F) |/ J% s9 F1 e t0 ^//速度(1-10)
]& N9 ~8 p! G; H: mvar marqueespeed=3
z- ]: j/ J* S; z! V6 Y; a- i//背景颜色
+ l3 d: H/ Z6 g4 p& P2 Svar marqueebgcolor="#FFFFFF"
- U8 L5 O. w% J/ G//是否能暂停 (0=no. 1=yes)?
4 O3 V0 s8 `5 K% uvar pauseit=1% f7 ]# d5 a$ X
* d$ I6 a+ }( x) X4 |//修改显示内容4 G5 I+ A0 C3 d T' ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 m6 ]% O' B z6 v
/ e9 P4 x1 {4 h6 R8 T- a; a! Y* P* V8 p/ Y6 W: K
////下面不需改变////////////
2 o" w2 w" X+ L2 u1 k1 v, p% O/ m5 b* t
var copyspeed=marqueespeed; C5 N9 J4 J( C
var pausespeed=(pauseit==0)? copyspeed: 0
6 R2 Y8 \' D0 O6 f9 G2 }var iedom=document.all||document.getElementById7 z4 ^; }, P# M5 \0 A2 C1 D% F
if (iedom)3 a- N9 b2 F$ R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& v, Z( W2 ]+ A. X4 N) _' P7 {5 i
var actualwidth=''9 ~4 f- L. F. S) D& I1 u
var cross_marquee, ns_marquee
8 j) X" g2 S- _0 ]# r( U$ a( ]( a) `5 W
function populate(){$ R2 u5 M6 F6 g Q+ A# N
if (iedom){
) k1 x p1 |; k# f. C' B/ ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 E- N! M) G6 s) I. Z% scross_marquee.style.left=marqueewidth+8* X6 C$ q/ g1 h7 \ H+ r. ?
cross_marquee.innerHTML=marqueecontent
2 C; _8 l+ x! \8 a! @+ v+ cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ Z! d; ^) i$ t$ e& b$ T* h4 \2 A}
0 L& I2 W) Z5 o t! Zelse if (document.layers){' L9 @" W: H0 g4 J& V
ns_marquee=document.ns_marquee.document.ns_marquee2% ^( k5 }. [. S( _- O
ns_marquee.left=marqueewidth+80 P/ k i8 D' h6 K
ns_marquee.document.write(marqueecontent)$ c! U3 P9 I! o: ~2 z6 h# B
ns_marquee.document.close()
. a4 @' V1 K% G( \actualwidth=ns_marquee.document.width
; c2 b$ \/ [' k9 G}* @3 {5 S+ u1 \2 |; c7 J0 i
lefttime=setInterval("scrollmarquee()",20)
8 s$ u0 @8 T( O) H/ v3 n( q! h' q, w2 i}
% q+ J Y5 T8 A" h$ e! _window.onload=populate
# @' |1 R }" m! x7 a1 h
- {: k0 W2 |2 p- @* ^: x" ufunction scrollmarquee(){
% W a6 M4 f4 @if (iedom){5 j- c" q/ w; U& o9 q/ x8 Y x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ ~! e% [% N Z8 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) t4 }) d, `) v
else0 r V5 `/ q! @2 \. I6 a
cross_marquee.style.left=marqueewidth+89 f+ Y" V& d) q, h v
/ O: _) m; O4 X9 g2 N) q+ D/ O}9 P" Q. C8 T* e4 t: c4 L6 t
else if (document.layers){
# I9 p. w" g: W: }5 f/ [if (ns_marquee.left>(actualwidth*(-1)+8))
1 {' e6 i' x4 H( x5 l Pns_marquee.left-=copyspeed- z* T8 M/ d! B) V6 i& x
else
1 \5 a) v, O- ]. z) G; `3 mns_marquee.left=marqueewidth+86 W. l% g/ j3 o& c F! v
}
9 K7 p8 i' Y4 [8 ~* ~; `, h; w+ }( B}/ A) t u8 T% ~, V- b
8 l5 c% R' I3 O6 q7 ?7 T7 `if (iedom||document.layers){
# Y6 U- }7 \5 `- _with (document){, S3 O9 S! P/ e7 U$ h) ?' Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 C, V7 Z5 Z6 Q: U
if (iedom){
# \( ?+ \4 `0 `% z! A8 h2 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- p+ m+ H5 n, }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 z9 D( |! k' X2 ?/ b/ E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); {, s1 k3 q: ? i! q4 I
write('</div>')# _/ P- Y" g. I' o x
}( v& y9 K4 F; S2 U" l0 v8 f
else if (document.layers){1 C( @& u7 n7 t( U2 q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 v) c" g& Y. u; C! n6 R% Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ {" T3 R, W( ewrite('</ilayer>')
# }( Q! | ]3 T/ j2 S& t+ V} l/ A: ~. K- T- U+ c- Q
document.write('</td></table>')
n1 h m' ~4 k0 s( S# z" @; V& b9 z}* a" G% W: J& m2 E( n( t2 I- `
}& w, g" b: `: m+ S
</script> |
|