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

|
网页之跑马灯文字特效
//修改宽度
* {$ E0 ], V- e \" p4 p3 Nvar marqueewidth=300
3 S4 }/ s$ u: K//高度6 l( D0 X4 w1 D5 v! z! `2 ?
var marqueeheight=25+ g& u0 D4 V/ c* ], K N
//速度(1-10)
; y5 F$ R9 `: T% evar marqueespeed=3
; n" c- Y* N5 \" k# Y+ v//背景颜色
& V3 n1 ^3 b% E- e8 r! y" m: Ivar marqueebgcolor="#FFFFFF": `; ?0 g# F6 S& c0 f, F+ A$ Y9 o
//是否能暂停 (0=no. 1=yes)?. u9 O) a% p: l" }, G0 Y
var pauseit=18 A8 U9 n# U; D3 D
7 a" |. R# ~8 q. S: U# k
//修改显示内容/ [% }& y4 `' B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* e3 K+ ~$ p# E
$ S. W8 N4 x- G
- c, M6 [0 `# B" V' m' p////下面不需改变////////////
5 z# m1 |. Z+ i) @$ B8 T# w
4 w0 y7 C1 [. r z, Z, @var copyspeed=marqueespeed
; |7 P7 {& w% S. W. M: a" S ~' Zvar pausespeed=(pauseit==0)? copyspeed: 0
, _, ^, `* l! M/ g% l" ~var iedom=document.all||document.getElementById: R2 M3 l( H8 a" t1 t
if (iedom)9 H3 c d% a8 r: O$ T$ @3 H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. h" p: [ m! { y7 O$ p lvar actualwidth=''' N7 a" i9 m8 X! S* C# K L3 C
var cross_marquee, ns_marquee
' Y& I. D; d! n& a$ k1 d0 @4 ^% ~4 p9 v" ~" G5 x
function populate(){
! E, ?* j! ?8 R( mif (iedom){' M( j: d9 x6 g4 A: ~9 p2 v. ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 z4 z+ v5 F$ r* y; K' t9 dcross_marquee.style.left=marqueewidth+8
( D! T) v5 j4 l& \ i' J( A* \cross_marquee.innerHTML=marqueecontent
) s- I( \) j+ @ jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- e0 O+ x5 [, r8 [8 k" H+ C2 [ }
}
9 v3 K d9 w+ c k7 F+ uelse if (document.layers){
# u% ^& ^$ Y# B* X6 {. Sns_marquee=document.ns_marquee.document.ns_marquee2
2 F: Y- X* W+ b A6 W" u# Zns_marquee.left=marqueewidth+8
" c6 N( {6 g8 S3 ~ns_marquee.document.write(marqueecontent)
: }. j) \7 x; Y! A) Tns_marquee.document.close()
& R- a9 X. C# R4 [. J8 e, factualwidth=ns_marquee.document.width, H1 T1 \# c6 p2 z% v
}' K- z: v/ m; m" f( w
lefttime=setInterval("scrollmarquee()",20)
: k5 ?9 L: k5 R/ G}
( D2 D9 k" G* R3 iwindow.onload=populate
& v# f& q) ]7 G! p( r6 u8 J* s# m t' W& F' l$ f- @
function scrollmarquee(){) t' n7 U- H: B# v
if (iedom){
B: s" {: x8 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# v+ \ U6 T# H$ a! z1 @4 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 ]- P& q* D' N* y% K
else2 c% b5 e4 g1 x, g) j/ ?( m
cross_marquee.style.left=marqueewidth+8* J. P" ~! q) {+ @
5 v/ B# h4 ^5 x- c9 [# Y
}1 o6 P8 }; U* |& }) A5 `9 f
else if (document.layers){. N. ~) C$ j: P- ^( { a) N) K
if (ns_marquee.left>(actualwidth*(-1)+8))
! c: w! V5 W) X/ kns_marquee.left-=copyspeed
* m' z2 f2 x5 Velse
5 a* O6 ~4 O8 u2 L+ Hns_marquee.left=marqueewidth+8
4 Z6 d3 g6 V% Z9 E. D}" s6 g6 _" @; m+ A- B# F
}
- |- z T) h. Q+ }0 L' K( N% k) o( Q3 P% E& W5 E$ e+ X
if (iedom||document.layers){
9 p9 O$ T6 G2 e; Rwith (document){( N3 L! e# p: r6 f$ I [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 @2 c# g+ E, p6 M4 N6 z2 p
if (iedom){
% j: s2 f. F5 G3 vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ j$ _6 I6 m6 R; t3 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 e7 d _1 F$ F9 L% |$ M0 E, ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 @# ]7 O/ y2 o
write('</div>')6 K, g9 ~! s9 v5 l
}! H3 @ _' G% ~
else if (document.layers){
6 \' u% W. H1 b2 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 {* X7 n* c4 g5 f. j$ z+ N; N8 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- A; l* k2 g8 ~! {write('</ilayer>')
b6 T5 [3 |9 y+ B- T}
5 g" F1 A. ~! C2 ^6 |1 Mdocument.write('</td></table>')
/ s! ^* r4 B) ]7 R! o- Q} d6 G. K, \5 M5 q$ A" v* S
}8 T. K9 v& o4 W+ [. h7 R
</script> |
|