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

|
网页之跑马灯文字特效
//修改宽度6 w& |: H r# n) j
var marqueewidth=300
! p$ c" w2 U6 o; N//高度
4 J) u" k" A" d! n% hvar marqueeheight=25$ _8 i/ A: U* }+ e/ k: F
//速度(1-10)
+ b" ?5 R0 s& Z. A7 ~var marqueespeed=38 Z9 Y! `# I0 H- j: t0 `& c* Y
//背景颜色
1 M+ o6 W& D+ ?' nvar marqueebgcolor="#FFFFFF"; b2 ^. x4 R3 r, L
//是否能暂停 (0=no. 1=yes)?9 z9 w8 m; f1 |- F6 p6 e
var pauseit=1
/ x5 J! N+ V4 S" ]9 F3 }/ }- C0 [+ @* a
//修改显示内容& F# B' W6 a! L1 N; P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 x% ~" K$ @6 A) R8 Z* m0 S6 J9 i
! Z, x, w; {6 j1 i0 O
+ y) K6 T' r3 e" S1 O6 t+ _////下面不需改变////////////8 d- U+ J% X0 C; m1 Q& f7 s V
3 D8 ]5 U7 q: f+ Nvar copyspeed=marqueespeed6 ?, G! O5 Q8 x
var pausespeed=(pauseit==0)? copyspeed: 0
; [' b5 v9 ^8 l. Y& k! Svar iedom=document.all||document.getElementById7 s8 m1 M6 e i. h2 `9 f% f3 x
if (iedom), O9 V, {% x" O9 L+ J( y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& I; V# B8 C @9 F P6 U) \
var actualwidth=''
3 w( Y( Z( }' Y6 g/ B. A# | Rvar cross_marquee, ns_marquee% i- W! b8 o' `7 S, i
! \2 y6 D! h0 b R* G# t
function populate(){% e) W4 R; ]! P- }/ Q; K0 h+ I
if (iedom){
9 I1 N& y) J4 r1 d) ^. Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
H4 \6 B+ f0 Ecross_marquee.style.left=marqueewidth+8; H; ?: V+ ^! k" c) F+ y& O8 B
cross_marquee.innerHTML=marqueecontent
( a& i/ d2 v9 r0 L# q, a; M: oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; k* \' t, M1 V$ E* V( X1 ?}
h) n1 n- B2 v. A2 [else if (document.layers){& [' q; L& {1 Z+ Y: Q/ F
ns_marquee=document.ns_marquee.document.ns_marquee2
+ Z! i. _' ~# E! Z2 h v" N! bns_marquee.left=marqueewidth+8/ p7 j( r' z% ^% F1 H+ ~
ns_marquee.document.write(marqueecontent)
' J" V. v+ F& r1 `ns_marquee.document.close()9 u7 ]1 l# I8 h: r* E( b8 E
actualwidth=ns_marquee.document.width2 T6 t7 k ]7 o' `
}/ H( M; k$ E9 R# X% \
lefttime=setInterval("scrollmarquee()",20)
" h3 o& K; ~8 v, T8 H6 o- [# k/ h}
U0 u8 |1 W; \window.onload=populate0 W6 A) S# g7 X# W
; p8 _; Z1 C g/ C# C: i! d# |
function scrollmarquee(){
$ ]. ?0 {# y3 l: ?, Tif (iedom){9 M+ P0 [+ M( @' O Z8 E: E0 h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); s8 ^ s% U8 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& w e7 {2 m8 V/ W$ I$ e) \- j9 w8 welse
+ C, e' v6 t! E zcross_marquee.style.left=marqueewidth+8# u/ G$ E @* u1 \
/ D/ E, ]: g/ J" y
}
8 l- H$ M6 Y/ `" c2 \else if (document.layers){1 B8 }1 j }' c
if (ns_marquee.left>(actualwidth*(-1)+8))& `; } E% A' c
ns_marquee.left-=copyspeed
: ?2 \; w# v H3 A" t- ^else" O0 b* y& B* s0 ^: E' ^
ns_marquee.left=marqueewidth+8
% \$ ?1 `/ e4 Q% {}
4 X. R* f: n$ M L6 o' j7 T# L}- M6 J: c- a1 @ `
5 j0 S5 k1 B/ R) e5 U* r2 f
if (iedom||document.layers){7 g! @/ u) G9 \' F* g
with (document){
2 f& I1 B2 m4 X) ~3 k, zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 X D& T/ Y- T6 G" A) |
if (iedom){
9 h6 R: b4 r' k7 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 R, \$ j; y" ^# R# Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# E& z" J* Y7 _! A6 H$ e& d$ Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 E$ X: d! R. o3 J, uwrite('</div>')
d4 T; Q" W3 p" y% {5 h7 b}) J: f% n! o$ Y+ G! f' I
else if (document.layers){+ L: ]. |& d b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: {& ]# G, d4 J) Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& I5 T( Q/ |* K/ I
write('</ilayer>'): X8 e: O) Y$ c s; t: L
}
; W, `$ r: \6 n1 ^, M. ?7 G" Y; Gdocument.write('</td></table>')# g& s% }# L9 W
}& E/ g% j7 W3 H0 O" C9 V/ u! G
}
& ?# f/ O# f- W) ^</script> |
|