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

|
网页之跑马灯文字特效
//修改宽度
# w; v& N& G. n9 j/ A% Lvar marqueewidth=300
+ q9 T! t ?: [+ G% G* G8 u//高度
. C+ `& B0 O: u' G1 [var marqueeheight=25: f7 a; I; a. m6 e
//速度(1-10)
& C: y7 ^' j/ Ivar marqueespeed=3. D1 u8 Y8 r3 {4 u# ~
//背景颜色3 p2 G) a0 p V. ]6 f, K5 ^9 H5 ~& j
var marqueebgcolor="#FFFFFF") C4 }6 p1 H9 R5 N
//是否能暂停 (0=no. 1=yes)?
% q) d( o6 N+ Avar pauseit=1
6 H4 h& n- F9 U! |' ] ]/ j. E, d
! }# y& i9 B# c; c5 ]9 X5 o//修改显示内容
1 w+ k/ z; d A7 n0 ]* dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 i$ N9 V( l) F5 H
$ ?! [( j r( Q$ r" q% w
; d! c0 C) w0 G+ x; ^7 y: [
////下面不需改变////////////
u8 r- M* n* q3 c- Q6 T( A% C% w" s' ^
var copyspeed=marqueespeed0 ^. V2 h1 _# l$ _+ r, `/ I
var pausespeed=(pauseit==0)? copyspeed: 07 l+ ?9 q" I. D
var iedom=document.all||document.getElementById
, l& }1 R, |. O' P" Lif (iedom)
* N, p5 E7 B4 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); b: b! f/ m- b$ K( h4 w; D8 P, m
var actualwidth=''% K: E2 G# D2 o; `7 Q
var cross_marquee, ns_marquee0 H& h* b4 L# I+ R. q) j
) c O" P- c/ s3 @function populate(){
, C# u& N$ {4 R* _1 wif (iedom){
8 ]* m8 @0 A; R, R) V9 h, hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: p: W$ C, L* S* ?, u$ M& z
cross_marquee.style.left=marqueewidth+8. Q0 h6 R0 j$ z# B) f6 n6 G
cross_marquee.innerHTML=marqueecontent
- K3 f' A/ r" w! A" c) h6 Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 m1 W) s$ T" p! o* u1 P
}
* H* ~3 |) m9 w0 j+ X) p' felse if (document.layers){% j m0 d2 u2 N+ |
ns_marquee=document.ns_marquee.document.ns_marquee2
. R. e+ }+ @8 `- H4 kns_marquee.left=marqueewidth+8$ U4 m% x; k7 T z, t! A" ^
ns_marquee.document.write(marqueecontent)( h7 v6 k; V- f. ~# b, ?
ns_marquee.document.close()0 M: T2 l1 i& x
actualwidth=ns_marquee.document.width
) G7 h, G* N' ?9 I3 L; _}
+ ?8 w& A- U7 G6 w/ L' W% m+ Jlefttime=setInterval("scrollmarquee()",20) {* B% P. i5 j/ I
}
% e2 d1 X0 F; c5 u1 `) R& @window.onload=populate
) ?- {+ x; j1 Y- p( V9 g: h" _7 ^! e) w+ `
function scrollmarquee(){* n7 ]4 M& d; u. K
if (iedom){
$ e, k3 x9 R- ?- fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% F0 S6 W; }# t5 k5 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# ^3 `( q& k J9 H1 J2 _$ m
else! E4 P. P; c2 ^8 H6 V8 {
cross_marquee.style.left=marqueewidth+81 k# j1 l9 R, g/ K0 ? `- U
6 B% V- ]# g( O; h7 v+ p, V0 y
}
4 C; Z7 n0 Y. }$ g- H6 }else if (document.layers){
3 G# C4 W+ D K0 l9 i, w) Gif (ns_marquee.left>(actualwidth*(-1)+8))9 g( O5 r1 S' L1 w6 Z* g
ns_marquee.left-=copyspeed, j4 d8 r$ V0 P+ e
else
+ [4 e9 @8 e! b* p* lns_marquee.left=marqueewidth+8
5 N# N1 S7 x8 v! d}- v/ y; a6 m2 J1 ^
}' l' j' j1 O' k
- L( Z8 C$ Q; s* y, `1 j
if (iedom||document.layers){# t7 M4 J) s' Y' `( d
with (document){
# e9 P/ e* ]* j) c, Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 Z9 U7 a" F( R; f8 r9 yif (iedom){' s. h9 M/ z u2 G! F) m5 t% U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' U" w/ q/ ]5 D5 x7 Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ o' |. R! I" `3 @. R' }, L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% p1 x) I. z4 r A+ mwrite('</div>')
H( c. ]! A) m5 b" `- L}
) `) T% w. ]8 d: }( Ielse if (document.layers){7 a1 Q* W, U4 @' m4 I# g; ?8 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, Z. k2 T6 y5 F9 Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): i$ K e& l8 g+ B7 \ }" N
write('</ilayer>')
3 z0 X, i; f$ a+ [+ d( ^}* B4 B4 N6 K; K5 [# ]- h
document.write('</td></table>')( {6 x8 ?3 ^% B: Z8 g
}6 a" o, a: H$ ?' H% s6 X' }
}
3 W& h+ {9 g' a+ _; I1 K1 Y9 Z* p</script> |
|