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

|
网页之跑马灯文字特效
//修改宽度
" v7 v' G. K+ s J7 ivar marqueewidth=300
. @# ? \& O8 T- }5 ?( l. b//高度% g5 W- [ h4 I8 E7 }8 ?( P7 g2 B
var marqueeheight=25
+ h$ S/ H5 [8 P- \7 v//速度(1-10)
7 e9 ~; h4 Y6 s4 {var marqueespeed=3
& o* n: Z, l8 \3 u' ?//背景颜色
W) C7 @. z: E2 B/ z8 h0 xvar marqueebgcolor="#FFFFFF"& k& R4 F0 C& O; F; C& ?6 Q
//是否能暂停 (0=no. 1=yes)?
6 ^7 C& R V' @# _var pauseit=1
& d3 v5 }3 V) q# D2 o) U' e$ `0 _- b' e- \! x7 R
//修改显示内容4 ^ y3 u3 R% `* }- K3 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ `4 |0 m; p8 {9 G
5 P: z8 Z- I2 j3 ^, f+ ?( [3 a3 T8 k1 I) I. i7 o; J4 V3 Q/ x3 B
////下面不需改变////////////
4 [& N/ i4 d, G2 O2 w- |
5 U% B) P6 V" c( \6 Kvar copyspeed=marqueespeed
1 G) }0 f& [3 V& _4 W% rvar pausespeed=(pauseit==0)? copyspeed: 00 ^' {3 P& L+ |9 Q
var iedom=document.all||document.getElementById
% L% |% J" K/ Fif (iedom) w2 N/ i! p5 t8 {5 v* ]! ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
l3 i5 K, X' j& Jvar actualwidth=''3 u; z2 e. K" k- I) P8 J' L5 _. L9 Q p
var cross_marquee, ns_marquee
5 q/ O" p2 z5 C" z. n; X
0 W/ _5 f6 c3 v+ h: a/ V0 qfunction populate(){
, h4 ~+ [( O& I* J( l$ ]if (iedom){
+ Z" g; R' G! }5 o8 a* r, _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 s$ K' L9 a' @/ |) ~, ~0 d) [2 u) p
cross_marquee.style.left=marqueewidth+8
8 [) @1 U; v# | ~cross_marquee.innerHTML=marqueecontent z- ]# F# b4 ?; c" ?, v* Z, Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; x, c/ R+ u! Y& D
}
3 d# `( \) m+ W8 O& Telse if (document.layers){# v' P) @* U+ x% ], V, O) j
ns_marquee=document.ns_marquee.document.ns_marquee2( ?; ?/ H9 R0 [7 p
ns_marquee.left=marqueewidth+84 t: L' e( |9 `+ K# O1 z
ns_marquee.document.write(marqueecontent)6 W6 r% F) N9 X m+ M; K, a
ns_marquee.document.close()
& k+ |% }) T8 l9 pactualwidth=ns_marquee.document.width
) `$ h+ k" I4 ]2 c, R9 ~- g}! y x8 e; i0 ]* d' h! @' {. V% q0 _% n. ~
lefttime=setInterval("scrollmarquee()",20)
- K- X# \+ }: @" e) E1 |3 Y}
3 J/ g) o0 w9 m* u, ]* O$ ?window.onload=populate
6 H8 h- ]' k9 @) q7 o. a' Q* s7 E- _, H# F# W6 K. r0 q
function scrollmarquee(){- z0 `( J: s0 H F
if (iedom){
$ ~8 K0 v* V, xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 }7 z3 c7 s [# E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. _; F+ E5 }; R3 d: q" A5 }; celse
" H% g$ l+ K* fcross_marquee.style.left=marqueewidth+8
& H1 l3 y2 t3 P1 _, e* F+ u; S9 I) c( z$ T1 z- ], J& r
}; c- d& ~6 `. X2 b: O+ M" D+ C
else if (document.layers){, }. K- B" R& j0 E% x- D
if (ns_marquee.left>(actualwidth*(-1)+8))5 v$ t4 ^$ m; r0 M+ u; J9 L. c
ns_marquee.left-=copyspeed
) @# S V5 n$ gelse3 w) f/ ^. b, m* G3 x
ns_marquee.left=marqueewidth+8' }2 N1 s/ B1 u6 j4 i, _. P
}
4 w) Z( c ~% M* j}: c0 V( O5 U, o# z' o( Y& e6 \7 M
" q3 l) ?& X9 |3 P, n
if (iedom||document.layers){! `, g7 G8 I4 i
with (document){
5 E) J k7 @+ S+ gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ |& ?" n: k: Y' ^. Yif (iedom){" t+ \; v* B( w+ E: k, }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): [$ t% `$ i9 W0 X6 N- Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); ^3 M& g* V( o8 q6 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 t% w1 k3 r" ywrite('</div>')) ?; o& Z6 H9 {4 P
}6 E9 {, D! V& ^" F8 U- Q
else if (document.layers){
2 E7 |* I8 y# r* w/ qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' R9 P0 D$ I! j+ A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 X1 K" n3 g6 X* h& _write('</ilayer>')
$ S8 J( {) E0 l* m}2 c* O7 x" n4 ^
document.write('</td></table>')
% R. D X5 E C' `+ j# J} o+ s, K0 e w8 s+ Z1 Z" G% p
}
$ ?% G) `. l+ Z+ p</script> |
|