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

|
网页之跑马灯文字特效
//修改宽度+ @$ m: S6 B( \+ w
var marqueewidth=300
" z2 E/ B9 d2 X- L8 r//高度
7 Z8 o# J" }; r' jvar marqueeheight=25/ i* y' \# s" f- J) U7 S
//速度(1-10)
% _2 i2 E) k0 k/ Xvar marqueespeed=3
1 V1 R1 Y) t) i( G0 T//背景颜色
8 c1 u @: F7 ~" mvar marqueebgcolor="#FFFFFF"% Y2 F4 u- E f) ~, z' `. ^1 k
//是否能暂停 (0=no. 1=yes)?) R! [2 E& K0 O6 q# {
var pauseit=1
. ]+ P) c% z' ]0 u1 S2 R! m7 Z& n' b! u" _9 }" s
//修改显示内容
# h w* i" q7 i5 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& i. W1 ], x) Y: j. l8 b
/ I- B7 ]; o2 D+ K% @+ Y
% r3 i p& G3 o, q: W& r////下面不需改变////////////
: z+ s1 x1 M: ^ m' D, I* Q7 A2 \ S, G
var copyspeed=marqueespeed
; [ l' C" G2 p! G: p4 t. h jvar pausespeed=(pauseit==0)? copyspeed: 0
2 T, h; O" b9 S5 o9 [var iedom=document.all||document.getElementById
- Q" p! B+ q* m6 U2 s: g( Wif (iedom)" s9 s% S) @2 @$ r8 m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 w* m8 t9 v' C& `& Tvar actualwidth=''7 g- ^/ Z" d8 C* ^8 ^
var cross_marquee, ns_marquee
7 N5 P- S- ^$ n, P3 p+ G: V+ t
! [' S4 E6 h' ~$ y; k( h' Ffunction populate(){4 y/ Q3 t" p. ~: B
if (iedom){
% D. X* s; L) y4 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* n. X0 o# V1 X1 i1 \5 i( a% ccross_marquee.style.left=marqueewidth+8
# ` ]9 c' b1 f" u) S- bcross_marquee.innerHTML=marqueecontent* }* g: ^ e( f6 B B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 h7 C }" A) u" F2 ~+ C7 @0 V
}
6 q. w0 f) ]0 h0 n7 m: Jelse if (document.layers){
. G2 c6 r8 m. c0 Ans_marquee=document.ns_marquee.document.ns_marquee2
+ Q: S( L; F/ L& H) _* _ns_marquee.left=marqueewidth+8
; U6 x* Z7 `+ k5 sns_marquee.document.write(marqueecontent)
+ R2 ?$ r5 _/ I3 R& w+ I$ ans_marquee.document.close()) P' N1 ]! ]6 h% i8 P
actualwidth=ns_marquee.document.width8 _2 L7 ^3 P: t2 O1 m; [& N: b
}
1 Z3 u/ o+ T4 ]6 I! klefttime=setInterval("scrollmarquee()",20) c( j8 x" v5 i3 g5 k* [" f# O
}: Z( K( u! A& t/ G# Y- s7 K& \
window.onload=populate
) J& [+ i' U" o Z& @" r8 `4 O. l* n( b. A+ h% U9 \0 l, w0 E; w& K
function scrollmarquee(){8 j3 |+ b5 N- t) Z# S! _
if (iedom){
5 E- @3 b& q) ~" }3 K* Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% P4 I2 K* C2 Y' Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 U( `- ^0 }7 [) c: m" I6 ~' Yelse& O0 r! x5 |2 X" Y
cross_marquee.style.left=marqueewidth+8
; q3 V. N, P0 o# }! H* H0 r: q: k3 L$ w8 y
}
* N' l. e6 m. z, R2 pelse if (document.layers){
$ |3 D7 c' G/ K. A4 ]if (ns_marquee.left>(actualwidth*(-1)+8))
! n5 C+ N% |$ i* p5 M; ^0 a8 qns_marquee.left-=copyspeed
% T+ j- b# g& Y2 w2 f, xelse+ o- A E* \; W+ B" ~( P
ns_marquee.left=marqueewidth+8
& u. N K! {2 ]}
/ Y0 P4 m: d3 S8 J+ [& U}
! h9 \9 B' e* g. G! ` |! ` Y ^, U. t$ T3 N& b
if (iedom||document.layers){
1 R: K3 Z3 @$ I' s; U1 b% J* m& xwith (document){: z* H: m; G/ K3 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( O1 q* L4 B4 L, l- U+ m. ^% q. {. P# Z
if (iedom){
7 k K# I, D% {4 l3 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) w5 X8 ?+ A' h) N! z: h, @7 ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, B. H6 [8 d- ?6 X( [, x9 `( cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), ~2 P3 i1 z/ s" ?: d% ?
write('</div>')
3 T) m" T4 y2 z3 I}1 x8 P7 z1 H# O# _) w
else if (document.layers){3 C; i/ `% J& D' h0 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ c: O* j6 [& ?- \3 P9 g+ \/ r4 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) s( @8 y: O, F; o/ K1 Kwrite('</ilayer>')
2 ` G0 O0 h7 l}8 k1 q; b1 f$ m- t% u
document.write('</td></table>')! c" E$ q) W' u' X6 H# h! s% H
}( t8 g- s W5 w* y* f5 ?
}
. }( I1 l. O* N: G3 p</script> |
|