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

|
网页之跑马灯文字特效
//修改宽度% V3 K7 ^( S/ h( P, \
var marqueewidth=300+ B% ~# U P" c9 z5 g+ X( i0 T+ i
//高度
8 g# ]' p" u* ?0 D" ~var marqueeheight=258 v; ?5 F) F3 D7 ?2 [" z
//速度(1-10)
' G# ~7 b O" D7 o4 l; R svar marqueespeed=3
& z! ]3 x; M9 J$ _$ ^//背景颜色* a1 G0 e$ P7 I) r% H
var marqueebgcolor="#FFFFFF"
/ D; M* B4 F/ w//是否能暂停 (0=no. 1=yes)?
2 p/ K7 B. m. K( p! t" A# n7 Gvar pauseit=17 f9 F0 F6 @# [/ A. X
, e& t+ X- [( s//修改显示内容2 f! b" V# G" h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 K! r4 b' Z5 I1 k7 d4 F
2 d0 t4 Q' n' @" c8 O
1 Q, V2 j6 R! ^) X////下面不需改变////////////
* ?( u2 Q& q( c* N7 m9 t3 V9 h G- Y( m/ N. t) h9 p
var copyspeed=marqueespeed3 u1 L+ f3 H$ ^ Q4 X% c, R0 X# @
var pausespeed=(pauseit==0)? copyspeed: 0- ^, D; L/ O% u) l2 x, o; \5 V. O, N
var iedom=document.all||document.getElementById
+ q9 c( T$ O; r/ ?, K9 ]if (iedom), \1 ]3 S4 d B |6 b1 K! T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ g+ E- Y/ k1 [4 [8 S1 Ovar actualwidth=''
$ |2 E7 \* ?1 E7 Q* G% a9 l7 B! lvar cross_marquee, ns_marquee$ N8 W% H" F6 p( t) s; ~
3 k$ H# u% G8 L% }2 h0 U, ofunction populate(){
8 L1 \% k; t9 `9 ^2 p+ pif (iedom){
* V8 y* p5 ? x. mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' |# c" I% I1 R8 j
cross_marquee.style.left=marqueewidth+8/ {7 L2 Z1 y/ [" O% W! y% `
cross_marquee.innerHTML=marqueecontent% ^! W' C' M: l [% L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 l1 e. w7 m" {1 j3 |) M. g) M) l}
5 Z( e7 [4 I( x1 _: g1 e1 b! Y" belse if (document.layers){
# ? p" n! m9 q1 h& k! b" Nns_marquee=document.ns_marquee.document.ns_marquee2
8 \+ e4 v; n, C$ N1 X* t# }6 F8 l( Nns_marquee.left=marqueewidth+8$ m9 w4 h% H$ A8 [* k. j/ g) t
ns_marquee.document.write(marqueecontent) m7 B" U4 P, J3 N! t
ns_marquee.document.close()
! x* N U# l3 j( u6 R9 Y5 ^actualwidth=ns_marquee.document.width# H9 b, n2 {7 Q/ C* o" G7 w
}4 `8 a2 j/ Z# p3 X8 E& @' u
lefttime=setInterval("scrollmarquee()",20). q0 x8 p: L: ^ c
}
* |& W0 v7 e v" B! Bwindow.onload=populate
' h2 T+ P w, a( q& ~2 Z* T* D
+ z5 S. K4 K' tfunction scrollmarquee(){
5 V! @' q- o7 a- C/ eif (iedom){: m' u) u- o* h2 d4 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 B! S- a- t; c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! }8 F* f$ b8 i0 m C/ e
else7 w; e& d8 H0 R! H
cross_marquee.style.left=marqueewidth+82 L6 c. L, B5 n
1 M: ?5 X; Y8 q/ `
}4 K+ j; P2 ~, h$ B
else if (document.layers){
_$ {8 e' f Z B0 V* O3 W7 m# f% ?if (ns_marquee.left>(actualwidth*(-1)+8))
9 @! ]7 b9 R, V! c O: lns_marquee.left-=copyspeed' q/ M8 C; V: ]6 D
else
, S/ ~/ A2 t8 ]8 Vns_marquee.left=marqueewidth+8
# |+ P* @# B0 \}
5 G0 A/ g+ u( o( ~! N& M" H# M}
3 R K' u7 h" J; F, |6 J1 X" u1 N2 V% m6 w0 J7 ?9 g) c$ A% o
if (iedom||document.layers){
/ V& c' i( u2 f: b- }$ v+ B1 @with (document){
6 E* v! r) K2 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ B N6 \; r' h# l" V' F5 a
if (iedom){
& C/ Q0 f5 x4 bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 O; a |1 Q( I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) A% G2 }; G' W9 N5 uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ i4 z' n. _* ?% S- M5 G$ n ?
write('</div>')7 ]0 l7 f. O3 E6 L
}
?0 J, T- D. ielse if (document.layers){6 u$ m% I& L1 W* E! ^- F; B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- x% Z5 v& _; p# V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% b2 {8 J! c: A& a* a uwrite('</ilayer>')" x) v [( a+ W+ O1 ^' W
}8 R7 d: i/ Z4 n0 o6 ^$ \
document.write('</td></table>'), _( h ^$ g8 o
}
9 O0 m9 l* B, k" e7 d' |}, `8 @2 n% t( E9 C2 w, V3 I
</script> |
|