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

|
网页之跑马灯文字特效
//修改宽度9 U3 n+ i5 J3 s z" r% [4 W& f
var marqueewidth=300
- H8 \$ y! [8 Q% t( ]5 a5 z. L/ o//高度; R$ {3 J+ K1 y
var marqueeheight=25% _$ k- Q! q" l. Y- y1 J8 f4 ?( R
//速度(1-10)5 V& E2 x8 P# D' p
var marqueespeed=3) d4 p9 J# g3 ?& \# l
//背景颜色& z# _& B x% `* R
var marqueebgcolor="#FFFFFF"
& A9 ~* \5 f5 q: b//是否能暂停 (0=no. 1=yes)?+ b( T: Q4 B* ^0 z7 t. T7 Z7 U
var pauseit=1, z& h( T2 G: S5 Y. R
# ~) P8 N2 D6 o) F+ ^- D
//修改显示内容
3 l; Q- @; E) a! A+ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 _5 v2 e; u$ b4 k. R7 \) _
$ g3 \5 L% k5 } R4 i4 G+ E
9 W* h5 n8 o" R" [
////下面不需改变////////////0 o m5 _2 k$ N9 N& W; R6 K0 {9 @
$ F4 R x y' v* ~+ u- y
var copyspeed=marqueespeed
/ d2 }5 o0 i/ tvar pausespeed=(pauseit==0)? copyspeed: 0; f4 R7 s# Q. s- ` r
var iedom=document.all||document.getElementById
, ]1 I$ d3 I8 f1 R5 rif (iedom)+ z- b( ~0 E6 x4 {7 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ i6 Z! G$ u2 ?6 J5 F8 [+ Q2 r& m
var actualwidth=''
+ U9 X5 k- W8 G7 y. D6 N5 h& bvar cross_marquee, ns_marquee* n( Q2 N9 O. z# P
. C3 x* j l' H; D1 c @function populate(){: L3 t. \+ b) N
if (iedom){
2 d, O3 F; {2 C3 N" @- e8 u6 z3 ^3 vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) a3 K: {5 L: q/ _5 x. A9 ~cross_marquee.style.left=marqueewidth+8
j/ B3 o g0 H# g3 _; y0 _; r! Ecross_marquee.innerHTML=marqueecontent
, t% C6 m/ @ Z1 `0 C5 T0 Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 ]# C/ c/ }$ _& P# w. d+ V$ ^
}
% v( e& H. E, F' Q8 G& Qelse if (document.layers){3 O# x. A) E0 Y0 U4 ^" w% o: h4 `
ns_marquee=document.ns_marquee.document.ns_marquee2
9 M1 R& D. h/ p' ]2 ?$ l! X( Qns_marquee.left=marqueewidth+8
, ^, V8 z/ c& g+ ~ W; ~! uns_marquee.document.write(marqueecontent)$ K. V; q; ?7 b+ v$ [) x8 h9 r
ns_marquee.document.close()3 n8 p9 \1 R n7 D
actualwidth=ns_marquee.document.width1 V3 d) ~ B* r) h% t' k+ Y4 @& i: g
}* a& E( n1 Q: y' m
lefttime=setInterval("scrollmarquee()",20)
3 P, I1 e$ ` r' R5 D* k0 h |6 G}, F2 s- Y2 p8 Y5 \9 n7 k
window.onload=populate: J* u( [6 Q9 E1 _& h A/ U
7 R. v2 ]+ W/ P$ D6 m7 q2 l5 Wfunction scrollmarquee(){
0 k' X2 u5 x7 P- q7 o1 rif (iedom){" X& l$ j! L- q" s" {1 P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 f8 d; ~( x' z1 N7 o: x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 B5 r4 a' {* m9 E1 nelse
* e; U: Q6 S* I7 h. P! Across_marquee.style.left=marqueewidth+86 _4 h o8 | h+ s" U" x
S& q2 d5 n( q+ Z2 M2 `9 M
}& K. o& R4 \, l/ j+ W b3 v3 t# c
else if (document.layers){
% y* b) I' C3 Oif (ns_marquee.left>(actualwidth*(-1)+8))
\: `; k# Q2 T* o! ]# Tns_marquee.left-=copyspeed; j- b3 r$ m, u' S1 }
else
- @, ^( `+ \6 r7 Y6 rns_marquee.left=marqueewidth+8
: M( ]+ F3 a( e9 r9 `}
% e r/ m( m, I3 T& e}/ Z) b9 j9 q+ F$ d3 b$ h" L* F
( z7 O+ a' A" A+ f- r
if (iedom||document.layers){
) F. |3 u+ o* x1 d8 c: ewith (document){$ t( y5 q6 P# h }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" h7 J! W! C% r+ Q0 e
if (iedom){
; ~* N5 P% b) t3 o5 \/ hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) k3 M' W9 W+ T, ]# n4 X A$ `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); ]) `2 w7 R. Y5 W, x" |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 u9 j. {; f; kwrite('</div>')5 G0 j0 [: _; h2 N* A3 r- d
}! p: S" G9 _ D( q# ]% Q/ c
else if (document.layers){' K0 w! I6 ]+ P$ }1 H* @7 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 z* O" W, ~: [4 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% q* u) s! |7 w
write('</ilayer>')9 g8 s ~' |8 L H0 [" E
}6 w4 u; L% F4 b0 n8 P. q. Y. k
document.write('</td></table>')
' N* |! H/ o$ t3 L}; Z- v8 |3 R! X+ o5 M3 i" ~4 c( o9 D
}5 Z* e! p) {9 k% @3 t% J
</script> |
|