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

|
网页之跑马灯文字特效
//修改宽度% x( J5 f: t. L! j; T" ~& ?
var marqueewidth=3000 L C1 i& W8 g! n: B; ?3 Y
//高度
7 f! G4 y" V$ \) s6 l, t0 hvar marqueeheight=25
; h* B# \8 `( d, h//速度(1-10)# F* i0 Q4 y7 e5 u- v) e8 f
var marqueespeed=3
" Y: k* m% L* D2 {//背景颜色
) B. b3 K/ r% f. kvar marqueebgcolor="#FFFFFF"
( |2 t( w% `8 }& V* g//是否能暂停 (0=no. 1=yes)?+ K4 p, U3 @7 |
var pauseit=14 J ]# \' p- y8 h" y. a6 {
- @5 ?% T( e' }( B( I
//修改显示内容
- p9 ^/ `+ J% d C* J4 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! Q4 I# `3 {4 r8 n6 V9 ]* B; l2 p G$ v, m1 A* n3 u
" l& a5 ^" ~6 g0 n
////下面不需改变////////////
% x- }( a D3 h. q' n/ U/ p' C8 b- q& j1 {9 Y& @ c1 w! |6 H/ F
var copyspeed=marqueespeed% q. i& U0 d5 t+ ?$ i( V
var pausespeed=(pauseit==0)? copyspeed: 0: w( Z4 d- J8 k w; ^
var iedom=document.all||document.getElementById
8 ]; ^" G7 T4 M; M, Y6 qif (iedom)$ j6 L+ j) L% [& Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 l9 @* Z3 t; }. mvar actualwidth=''! l& N, w/ l2 A3 w1 t b
var cross_marquee, ns_marquee/ M; X* e) D' W; p! o
) `' c1 F/ j- Q8 w0 ]& O7 {
function populate(){% F' g+ E7 f& S6 Y! r! v
if (iedom){# O% k) n G5 I% _! [7 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 n( d' N, a8 O/ x: z! c
cross_marquee.style.left=marqueewidth+8
/ W. `) _! U) o' k5 J4 l) X, O# ~cross_marquee.innerHTML=marqueecontent# K% h2 D% k5 Z1 F* X7 i9 R9 B4 C/ P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, C3 d, I- c. }3 \& m5 H1 D/ r
}
: i( [. [( Z" {5 D; a9 m: ^else if (document.layers){
4 z; ^& O. _% a/ vns_marquee=document.ns_marquee.document.ns_marquee2
9 r: ?4 }% ^% F& o7 _& `ns_marquee.left=marqueewidth+8! h: g% o' J/ `: Y: J6 q
ns_marquee.document.write(marqueecontent)
- O9 P, Q" F# N# \( n% Hns_marquee.document.close()
" C% N4 M) N2 B3 N0 yactualwidth=ns_marquee.document.width
; U3 l" ]& t- o; _' R: H}
- s2 I8 o2 b9 ]) j) B: }& F. plefttime=setInterval("scrollmarquee()",20) M8 V3 h% d" W) o/ J. l
}
8 ]8 j% ]$ N" E( Uwindow.onload=populate5 a, {7 Z7 y. p2 H0 }
) H* a J, R: S }. Q" ]function scrollmarquee(){2 [% Y; D& Y$ e9 }, Q7 z) s
if (iedom){
' r% ?) J# F, w' A; M: ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# B. Z M, D3 d; m- \# ]/ z$ j/ z; hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 ]- ]% L% S3 y' I; }else& c0 O9 Q9 D2 g) Q# X4 d
cross_marquee.style.left=marqueewidth+8, b& L7 e) r7 z' _0 `- t) _! J% W
3 q3 \3 h" Y$ ~, q, x4 }9 k8 b9 q/ Y
}# ^" o; V5 F+ `9 {" p8 k' r% n, R
else if (document.layers){, W0 ?1 c4 T8 z6 J4 c/ U: M
if (ns_marquee.left>(actualwidth*(-1)+8))3 U r% o! {5 E" |+ h: B2 j( [
ns_marquee.left-=copyspeed
+ z5 q0 }( y# h5 belse5 \, x5 E" V; [' h l P
ns_marquee.left=marqueewidth+8& i9 E# ~, j# O; Z0 V
}
% l7 o8 u# Q. B4 f7 r+ E}7 s/ ^0 m+ G& Z2 ?- V
. Y- [4 [1 X) h, S1 O; A
if (iedom||document.layers){1 D% \( x+ z! y8 O" Q2 U4 K+ z: f
with (document){
% ~- j2 p4 Y% P: ], K- x) bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 ?7 f# x8 u' g' N: U- Z
if (iedom){1 Y1 O" @/ M+ u; ]! a! V& t7 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( E9 r( I6 h" A. y( Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, w7 N/ H- [' p2 P% p! p. z9 Z/ b) twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): u9 x0 U( I' T, F1 U' j M
write('</div>') }- L. k5 Q3 o+ A3 r$ ^5 }4 C }! {
}- }' c6 n5 a0 W- a3 W% ?; o
else if (document.layers){
8 J. J$ |6 ? S. y% wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) z1 O2 z: y) m) C2 t/ c4 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- K8 a# J* O# T+ ~/ R6 M& D1 ywrite('</ilayer>'); E- a3 i; y9 @0 V. Z
}
1 R& k: }. j5 h) I6 G0 a% L6 p( U- vdocument.write('</td></table>')
7 |$ }9 ?0 P$ D7 x5 J}
+ y. d3 Y4 j9 @8 e/ B}4 L9 L8 e3 r8 m" ~( l |
</script> |
|