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

|
网页之跑马灯文字特效
//修改宽度
' z4 g' M4 C `2 X9 g7 \6 rvar marqueewidth=300
. i! r) v1 }: v% L6 m; Q//高度. P6 X* y/ S' y' H( [1 }* [, Z/ X
var marqueeheight=25& V) d; M! C) {+ e' f
//速度(1-10)+ b6 |! O1 q! O( e& o& p
var marqueespeed=3
# V/ u! `( r+ m \4 \0 e" l: P: n//背景颜色" ?1 h2 H& G2 y4 m2 v
var marqueebgcolor="#FFFFFF"3 Y( N5 b+ f3 o! p6 y+ Q! l; M- [, S
//是否能暂停 (0=no. 1=yes)?
$ y3 P2 c/ H% @- `' e! T3 Ovar pauseit=1
* ?7 F" r- ~5 Q3 R+ K$ w+ a. B3 d& Y7 l& X" k8 ?" G5 v" P
//修改显示内容
5 L2 u9 F: _0 y- b- kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 ^8 k2 B8 @8 \/ K) o) Q2 C" o5 Q9 [( O6 X% B; \9 o; `+ E
! V5 P. `8 s% X+ i7 R% L/ g5 T////下面不需改变////////////
, u4 R# [: W# n( u; e& l: ]- y, W2 z1 R& ]/ I6 A0 f/ r# X
var copyspeed=marqueespeed
1 \& I" {+ e1 t' C' Ovar pausespeed=(pauseit==0)? copyspeed: 05 |) B: ]8 x& v; C8 a2 S
var iedom=document.all||document.getElementById6 j; _- y% R& r, q# Z! T# [! x
if (iedom) ?3 M! z/ ?6 e1 Y, l b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. z& m: P1 O# j4 K+ J3 Dvar actualwidth=''
9 t; b8 t7 s' R' g& }" c; c" Wvar cross_marquee, ns_marquee; {; A$ m- N$ A4 }* o" D
6 H$ D. _5 F4 v
function populate(){1 x, Z" X/ }, l( y. m, f
if (iedom){8 \4 q' ]. f( }2 t) e f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! a6 ^" ?) w: X% H3 b1 d" J* M% V
cross_marquee.style.left=marqueewidth+89 R- u/ i) N$ w8 `2 ^) f |
cross_marquee.innerHTML=marqueecontent6 Y: u' B& K, {; M% x1 T. n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, S' J3 Z4 t. _/ c$ y6 l( w}
) e, v7 k, |9 K6 j1 Xelse if (document.layers){
) x% z$ m' @- C) y1 pns_marquee=document.ns_marquee.document.ns_marquee2# P& i; @' X C" }/ Z. @- Z, P9 o
ns_marquee.left=marqueewidth+8. [& R' C6 V, A9 v, E" O3 P- Y$ b3 h1 E
ns_marquee.document.write(marqueecontent)
+ k; v6 a" q% n. n X+ E" f" Kns_marquee.document.close()7 L( C- j6 r; H: p: a6 V
actualwidth=ns_marquee.document.width
$ Y: ]- C- r1 U! y" N3 p! h1 j}1 v& d' ]1 |9 a- ]( F# H- ?
lefttime=setInterval("scrollmarquee()",20)7 V) U/ ^# C3 s! r& x/ j7 n
}
7 a1 n0 W: N0 J- swindow.onload=populate
# y0 Q, M% a# Y7 C, H \$ P/ P5 a: b/ a
function scrollmarquee(){
2 x# C6 Y( X, k0 v4 I7 Aif (iedom){- P- Y+ V0 a1 e- ?( P0 A4 v B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ t; T: h. m, J. A# X! o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' i1 z1 v! ~5 y* d7 g8 qelse
+ R$ w' S9 K' }/ f5 p0 |cross_marquee.style.left=marqueewidth+8
: j3 e5 {* U( X
4 R. Q) w$ w$ L' \}
U8 O5 @3 G9 g$ [else if (document.layers){
3 m( Z- j4 J) D4 nif (ns_marquee.left>(actualwidth*(-1)+8))
, T V) W# |9 {1 K ~) Sns_marquee.left-=copyspeed n) h1 q# F7 w' M1 F' I( u2 |
else
$ |( X6 s" \ M7 G# T8 jns_marquee.left=marqueewidth+8; D C3 J2 L# p% F, @1 D
}7 W& F' h+ o3 _2 `! x- r
}% N' ]8 N! [' j b, e6 D, x
1 V# K; h. j7 M
if (iedom||document.layers){ Q. X2 y% Z3 {
with (document){
6 `- E" B+ `: i+ ^( x, \9 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 h; |4 `3 v# { k' ?- C' Y
if (iedom){
7 q6 Z0 ^7 y0 _: W2 k3 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( u. }. R% F+ e+ X. U0 p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), v$ X: p1 s- P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% `3 g, l2 D4 Z" Rwrite('</div>')
- Y8 ^& ~* N- W3 w+ a7 f+ ~9 X}9 o0 M2 h s4 N \: B
else if (document.layers){ A* D( u) B8 o. n* ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 { g0 t0 T( Y, u. W6 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 e. c# U [0 ? a6 r0 ?$ A
write('</ilayer>'): x; k6 M- v9 v3 U5 O% r
}
4 F O: h! l2 t! u1 x* D3 tdocument.write('</td></table>')' i! E( V3 ]7 G9 W( s
}' M9 i. z$ K( n% g: D9 C. E W6 p
}
2 Q, O: Z4 ^* s+ ?# s! S</script> |
|