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

|
网页之跑马灯文字特效
//修改宽度
; h: t3 E0 x" M2 b* M$ ^* |var marqueewidth=300: @6 p, u. b/ U
//高度# s S; ?; `. ^6 v* I* E9 Z4 w
var marqueeheight=25# ^5 G$ c' X6 [9 Z+ M+ J3 Q1 v
//速度(1-10)0 l: K, w9 ~" g$ Y# C# ?
var marqueespeed=3+ U7 o6 @: L9 s0 h4 N0 |; s& i6 {
//背景颜色
9 n$ L4 w a5 J) d( X4 m: Q4 rvar marqueebgcolor="#FFFFFF"
( T" X* m* p3 ^) H5 @: S0 Z//是否能暂停 (0=no. 1=yes)?' m, b3 {3 t) o1 r m/ z, y
var pauseit=1
7 o1 V- D/ X. B0 ~2 s8 k3 ?
9 d& J7 \, _# D4 s//修改显示内容
* y* Y) s. W! u6 |: a2 p4 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" _) K( H/ m9 S4 q; L/ l% N; n
' I0 ^9 h: ]2 S+ f9 I0 j2 @
; \. I8 s3 Y: h' ^1 v) ^5 l1 ?5 I////下面不需改变////////////
# `# ^8 t3 M! K" O' U- @7 S5 i. v$ m# {' E; G9 i. D- d6 G
var copyspeed=marqueespeed. n: q' [; n9 ~/ p
var pausespeed=(pauseit==0)? copyspeed: 0' P( h- k* h0 |6 R
var iedom=document.all||document.getElementById
& h2 T: Q0 E, T! o8 bif (iedom)3 v- ^$ c2 ]+ i1 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) ^) R& u- ~: k' N6 P; Avar actualwidth=''0 ^2 i+ H& S: Q9 ?6 ~, f
var cross_marquee, ns_marquee& i( S$ c: g) p ~4 h; Q7 _# q
7 o' ?7 m$ ^+ R' j9 n
function populate(){$ r- ?& \ `8 Y- c* Z
if (iedom){
2 b3 }6 J4 k" N7 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 y3 A, ?; c; B; a5 Z6 m( }
cross_marquee.style.left=marqueewidth+8
( N+ e: N, k3 s( Xcross_marquee.innerHTML=marqueecontent) e, o( S- ]/ s$ J1 O4 r
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" M) T5 T* w: C/ O}
! r! `, C& l& v$ e' L9 selse if (document.layers){
7 x( o6 t" t6 S2 G+ @- [5 Y$ R! y: bns_marquee=document.ns_marquee.document.ns_marquee2
2 {3 ]& V. e& ens_marquee.left=marqueewidth+8& b7 I. j7 I+ p) M3 B# g. P
ns_marquee.document.write(marqueecontent)
# j; E1 l$ r# Y6 Lns_marquee.document.close() v5 K, {' Z8 w) C0 l+ P
actualwidth=ns_marquee.document.width& e1 M6 T' A% V% Q' g& ~0 I3 E) V
}7 B% y( p/ e' h }
lefttime=setInterval("scrollmarquee()",20)5 j& p6 `# h b. a" @% O
}
5 v/ P4 b. x' X0 C9 Nwindow.onload=populate% f. S- |5 D" f8 n
' B) T& W5 ?# s1 O
function scrollmarquee(){7 u6 W7 p7 S9 S. F2 ^
if (iedom){- q1 X: D p5 B5 O- m9 q* n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 ?5 w, l, @# w: ]% h, ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 B r2 ?" S' @1 Q/ M1 uelse
* J8 S. o- T2 m% |% vcross_marquee.style.left=marqueewidth+8: A1 B/ J! @+ }3 H: e$ Y; Z) u
* K- m3 g: s4 M- N5 G- E- X, l& N/ K
}2 R: ]# J6 p8 @9 ~& w+ y
else if (document.layers){' L; Y. a' L( o& n; p* p
if (ns_marquee.left>(actualwidth*(-1)+8))
+ [' j, W' l+ ^& E; y- y1 \8 {ns_marquee.left-=copyspeed
% y6 ~4 E' S {/ E: Helse
* y( y2 I& V8 R- q; ^+ G7 kns_marquee.left=marqueewidth+8- ]' T6 U1 i7 `$ k3 Z# \
} o1 j/ G, u7 C) N3 ]; C' M
}
( w& @& b- U8 G/ G, V% O8 j" Q
P' U( H- L+ z$ R& sif (iedom||document.layers){
6 h: ?# o% b# x8 W/ N% uwith (document){
1 X/ @. Y0 e% l' D* Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 z/ w! V! u7 ~+ e
if (iedom){6 [3 @, n5 M2 F+ s3 e P( }; A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 I) K$ g: r& m5 ^: l' ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 c/ M0 W' v8 U' ^8 \# M( S7 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 T V+ r8 u: E4 v& w, Z
write('</div>')/ b% b: U y: e6 T3 D! S, w
}
! v6 S I; @1 f3 E8 {6 T: Felse if (document.layers){
' O) ~/ }; R3 J. twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ g/ M: l8 h* Q7 ^6 g1 Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* ?5 `# X; |7 `( I
write('</ilayer>')
5 w/ \. {. e4 C, R9 x3 u% k}
8 C. r6 W0 b1 _$ I; X( Ddocument.write('</td></table>')
$ ?1 a, ^( F% Y' _}
, N' e6 [' Q% L8 ?. s}; k+ k7 w# ~; o9 [& }2 `
</script> |
|