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

|
网页之跑马灯文字特效
//修改宽度1 C9 S# I& u/ A1 ], v1 D" g
var marqueewidth=300
+ b, M5 \0 C1 |: @//高度9 }% `4 H M) R+ `! T1 k% x
var marqueeheight=252 {1 y# ~/ W# V2 N5 a7 Y
//速度(1-10)5 U) V+ i# l F+ z$ E; C) Y O9 J6 ?
var marqueespeed=3; m2 T) ^' t9 f! ]& j+ K
//背景颜色$ m* e( |: E- U3 e0 [7 R
var marqueebgcolor="#FFFFFF"# ~8 w9 ]7 D, g7 t
//是否能暂停 (0=no. 1=yes)?
- r+ h0 ~/ a+ H& }6 ?. ?3 rvar pauseit=1! A% q7 D* h; P2 i
: c" T9 P& Y: j0 Y( p% @
//修改显示内容
. L7 |" b. \1 `; \/ o) z" W' Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. D+ X/ k" t: \7 u$ Q
1 ]1 @+ I/ _& o; T) S
& \ X$ u; R7 v" K) @6 M////下面不需改变////////////4 c6 O, z9 s2 u
" U, y& h( F/ X% h. Uvar copyspeed=marqueespeed
- T4 m1 T4 z/ B# h, [! ], Tvar pausespeed=(pauseit==0)? copyspeed: 0
7 ~! [; M- Y0 avar iedom=document.all||document.getElementById0 f8 t+ o' n4 @ w- r) r& D3 o5 P
if (iedom)
$ U c# R+ g, \2 v; `. n, z5 Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 ?. W8 ~$ x9 p4 Y
var actualwidth=''
# Z' o* I: g' M) } J( N& X$ x, ~var cross_marquee, ns_marquee
1 s: {4 d g% M1 T% Q3 M$ o7 z
u2 C/ a+ l& D* A. ?# v# x7 Lfunction populate(){
4 X1 o3 X5 E% Q+ L7 S7 cif (iedom){8 J2 j& y2 }% u3 h" g1 e+ y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 _/ }+ r- i+ |. D6 A& K8 c+ Hcross_marquee.style.left=marqueewidth+84 K4 X( y& X2 I& A7 B
cross_marquee.innerHTML=marqueecontent
$ I+ m) l8 D7 A/ _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) b" v& ]. U ?. h
}
* z& X$ G' X6 [' v- \9 o9 Kelse if (document.layers){, C, z1 G9 w6 P+ k! y/ S. {+ H
ns_marquee=document.ns_marquee.document.ns_marquee2
" D! y5 R% Q0 Qns_marquee.left=marqueewidth+8
; `2 G8 z/ b5 uns_marquee.document.write(marqueecontent) o ?7 \/ ]3 l5 v
ns_marquee.document.close()
+ j2 G5 c' i9 A' Xactualwidth=ns_marquee.document.width
( R! i8 e x% V}
8 f! A5 b- g( ^7 o; }: ilefttime=setInterval("scrollmarquee()",20)
1 }- Z8 A. Z i3 l}
; {: K9 K8 {. f+ Fwindow.onload=populate$ l- J) M, S3 ~/ F
4 g; J% {3 S9 P- u( v+ Nfunction scrollmarquee(){
9 r7 `# M1 E1 ^if (iedom){
/ L7 U5 |; K$ qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 t8 d N7 V O( v/ F" |/ l6 y8 Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ C+ P% U) F5 R/ M) M2 l; H
else0 Q" z3 e7 T% x. [! `
cross_marquee.style.left=marqueewidth+8, `5 I' F$ s, {# ~7 m$ V/ u. R
l; y/ c6 o. h}
1 Q9 d- f3 {) y- p) v/ B" helse if (document.layers){$ }% h) y$ C. Q3 [! O
if (ns_marquee.left>(actualwidth*(-1)+8))
8 v. c! a7 J4 F: ^0 O( Gns_marquee.left-=copyspeed
" s& j1 S, g9 |+ A0 felse# {/ u2 R6 {+ H
ns_marquee.left=marqueewidth+86 c- u- Z, N0 `9 l; L9 p
}
' B- |3 g2 I; u2 S* ~" Y}
4 s. A- Z* k2 j2 a+ p5 K! `3 M
5 n( G: n! w# x/ C M) @) ^% Xif (iedom||document.layers){
1 w# {" U. }' W! gwith (document){; Y6 ~: G: H, K$ o/ |- C6 w; W: k' F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ h. ^% x, M: h7 S& {0 Tif (iedom){
& Q2 L' K* w5 w1 U# v9 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ |/ V/ k- o( o Y! O3 hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' f* Y0 D0 z6 q2 E" g2 wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) N7 S+ ]5 A5 ^+ @/ i+ G
write('</div>')- M2 q2 [3 M1 o* U
}8 `/ l0 ? O% ^1 i
else if (document.layers){
) M$ \$ V. C7 @( R3 c8 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 v2 u& a2 p; Q: M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 _0 d& @! m' G# T0 x1 X
write('</ilayer>')
7 p; G( J; r/ V2 G+ r}
% N8 k3 g0 r$ ]& k6 P$ Idocument.write('</td></table>')" `% f# [9 _) h) I1 b9 Y2 m
}
- P: E. S4 e- r}! ^. l) ^. t3 }" f' z' w e
</script> |
|