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

|
网页之跑马灯文字特效
//修改宽度
2 T, {; v+ C9 }var marqueewidth=300 D; O- }# j8 R$ U4 M
//高度+ K& }" X2 ? a1 t- T9 Z- M
var marqueeheight=25
0 Q) q T* D( u6 `1 O//速度(1-10)0 F$ E; B- x% d# y9 m) j. S
var marqueespeed=39 c7 w7 j' o, t6 p
//背景颜色
* x& H" D* w2 }4 U* ~var marqueebgcolor="#FFFFFF"
: m, T% F7 n) [" p//是否能暂停 (0=no. 1=yes)?2 T5 h4 X4 ~9 o( R! u
var pauseit=10 ?5 y* { P4 K2 N2 h% L
( \" @1 S! K- f" U, w% `: B' p//修改显示内容9 r5 n4 V3 `) ]0 F) P& M/ \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# o! S: y7 S6 g3 c- r
4 E( E7 d: N4 Z3 p/ N
. u3 h: D8 M9 |0 B" F; s, ?" o) q////下面不需改变////////////
; ]; G6 _5 a3 Z" K+ u1 o; j7 [5 B- j Y1 W1 l* _9 n6 j( F
var copyspeed=marqueespeed' N4 F. G) _9 j5 G
var pausespeed=(pauseit==0)? copyspeed: 0
* a2 D" ]9 n- e) zvar iedom=document.all||document.getElementById
1 b0 v5 f6 X$ T5 I, D W" bif (iedom)% {+ k! m1 f3 w" s0 L* y" U3 R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% b+ }( w' h6 Xvar actualwidth=''
( ~* |9 {4 R0 Z* j3 D: F3 O0 zvar cross_marquee, ns_marquee. p I( p& ^1 [* V/ ^/ P4 N1 ~2 G
1 c2 X8 i) m& G% P. d! h
function populate(){ _; z9 W0 I1 ]& V; U/ k
if (iedom){6 G/ Q3 }! d% X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* g, x+ i4 X6 H
cross_marquee.style.left=marqueewidth+8( m& \& ?' n [0 I: U
cross_marquee.innerHTML=marqueecontent# c/ K4 N S2 W3 X1 n5 q, r
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- M# P# _8 P* m6 }" f% Q/ Y}
6 L6 n' @: W8 }, j6 C$ qelse if (document.layers){
7 T; T* Q4 }9 S- V' mns_marquee=document.ns_marquee.document.ns_marquee28 f4 M) w! v8 N: S/ R
ns_marquee.left=marqueewidth+8* ~7 Z' `+ M. D8 b! [! R
ns_marquee.document.write(marqueecontent)
* h7 D1 f/ M$ E6 K0 nns_marquee.document.close()
& i# t& K. \2 d8 J1 Wactualwidth=ns_marquee.document.width3 X1 \6 f- Z4 r% P% _
}
' r5 n( _0 g& hlefttime=setInterval("scrollmarquee()",20)# ?/ Q# z! }- o6 p1 `# c( O. J+ l
} L' Y V4 K* B1 s; c9 G' s9 V% c
window.onload=populate
8 r( j2 |/ r; h' x
" Q, X. w& c' `1 r* d3 u. p+ Ufunction scrollmarquee(){
1 j9 V' y# m. M5 l; ?+ qif (iedom){
- ^3 ?5 g$ M, w" z7 c2 A( ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ a" Q2 r1 g! E1 mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% Z, `! ?2 l& A- |+ ?! T* K
else
- L( ]6 C$ b. P: dcross_marquee.style.left=marqueewidth+8
" W3 ^4 ?7 A5 y R( a
3 R. W! J& D/ }}: S) `% @# |' _7 D4 ?/ l
else if (document.layers){
5 E) K9 u$ ?4 O- a7 ~ U# V+ S, \! sif (ns_marquee.left>(actualwidth*(-1)+8))
) N- e8 V) c* `: ?/ r2 gns_marquee.left-=copyspeed: C! }9 S- ~2 j' A; ~1 ?
else" j0 q6 N# c$ _! Z6 e" f$ Q
ns_marquee.left=marqueewidth+8
7 R" }7 G/ g* \}
" s' G2 H$ v- l7 g3 b, B5 u}
: M2 ]$ H* h) w& I3 T( a: H2 V5 V6 h; `
if (iedom||document.layers){
3 i! d: J+ m' N7 o7 ? Y2 awith (document){" s; \* l6 t4 t/ j R6 X0 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 Q( E2 \1 G, Nif (iedom){! [/ P$ o! _3 m5 h1 M$ i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 e: x1 ^: j3 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: P% v: x c, x1 S/ h( m+ xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# R! Z* t7 } x- b; a
write('</div>')
% r; k) p" |: G; o& M. Q' r5 x}4 O, q) ^4 @ }6 b
else if (document.layers){6 ?" R; x7 x) {) X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' @' b; q7 x/ d9 h9 M$ ?9 Y! U$ l" u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 ]2 D; I" ~7 L _9 P0 N
write('</ilayer>')% F2 i5 D/ v" t' H
}& q5 U2 t5 l% @0 g' ?/ D
document.write('</td></table>')
$ H3 H! }: C5 u}+ f3 B2 r7 [. F
}
: s, s2 G: x, j( i8 T0 [( A</script> |
|