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

|
网页之跑马灯文字特效
//修改宽度% L& A- } r' o/ t4 l' V1 |# q
var marqueewidth=300! S6 g g- m* ?* ?9 P6 C, ?1 p
//高度
9 t, x( F( @- X8 o/ g: D( I% w! ?, Lvar marqueeheight=25
* R! M( r2 Z$ r) n1 u//速度(1-10)
* @: ~2 M) l% b* s; k# ], Pvar marqueespeed=3
8 {) m8 `# D$ v4 r9 @6 X# y; n6 b) l//背景颜色
0 O4 S- o( U6 ~9 W1 J6 i! ~0 O3 e2 J8 Dvar marqueebgcolor="#FFFFFF"
* B+ V; y( [2 P+ c//是否能暂停 (0=no. 1=yes)?8 F( X7 K/ v! g. G' G
var pauseit=1( j. a) W0 h l
7 O' [) ]* S9 w( K//修改显示内容
7 T: s/ x0 W' P. u0 e& zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 X/ V) z# @6 D* z2 g# Q- s- H
) F. A G/ d' f% Q5 e1 l
4 s8 O6 h9 N( a1 K8 ?) I3 T////下面不需改变////////////$ g- l9 J+ Z6 X4 X7 |: v0 `
, M1 |) {0 j0 B7 l6 D. N: `$ `+ i# R
var copyspeed=marqueespeed
8 B5 a/ I8 n0 s# _3 F" ?! o+ x+ Uvar pausespeed=(pauseit==0)? copyspeed: 0% p3 R M2 Z& f/ r5 N( I- |; E
var iedom=document.all||document.getElementById
, M% B) n1 \% W0 fif (iedom); q& [% X. v' M8 d6 y8 A! J! F8 n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 C4 G$ ?. A8 Fvar actualwidth=''( g; y" `9 r" ]2 p/ @
var cross_marquee, ns_marquee1 M: f) J. @2 s9 j! ? ~
# X( W' s8 X" E
function populate(){
$ S+ R; d3 ]1 F7 W7 C, Q: Y) @2 Cif (iedom){: M6 N" T; s0 l/ W0 b8 e: R1 x" g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: k7 C, j8 i: `+ H% ?cross_marquee.style.left=marqueewidth+8
& _3 G7 Q8 ^. g! f: ycross_marquee.innerHTML=marqueecontent
$ r' i& Y6 I2 H e/ a3 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 q: g# z( t5 ?7 K4 W( M
}
7 Y8 p9 l! O$ {% T0 nelse if (document.layers){# B- x" \ ?6 k! |" H* V
ns_marquee=document.ns_marquee.document.ns_marquee2/ j5 O" W8 g M/ u% _) d
ns_marquee.left=marqueewidth+8
- ^+ V1 U' X$ X' h! h/ K0 zns_marquee.document.write(marqueecontent)
7 l2 J) R1 b8 A8 g0 _; Hns_marquee.document.close()
5 x; I$ h6 q9 W- xactualwidth=ns_marquee.document.width
4 Q+ X3 F z1 [3 Q0 l}
1 {& m i+ a3 E* {6 {lefttime=setInterval("scrollmarquee()",20)# k+ N) X- \0 H- x+ G! g
}
+ `( J1 P# q4 I- \window.onload=populate
4 v8 y0 q% @5 X* W6 H8 a- i, o
6 e: [& }1 R0 y. G1 F* o* v, hfunction scrollmarquee(){
: |$ Q/ v O$ e) P8 Rif (iedom){- I0 _( E Y5 u5 W; [4 k/ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( F1 }+ L' ?& v: M2 X* _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- Z. D A. z8 t6 M
else
: U0 W; m' ~- r) z. T) H2 mcross_marquee.style.left=marqueewidth+8
) v5 \4 R7 I" ^- q4 K' Y, y1 w9 U, V0 C$ a6 [$ ]
}1 L1 p" l1 \( K9 @( M4 Y- U3 ~* B9 v
else if (document.layers){
; `8 `' j# ~4 }/ K+ \/ Nif (ns_marquee.left>(actualwidth*(-1)+8))% p1 `5 [3 Q) O, z' m' V
ns_marquee.left-=copyspeed
1 E$ K& F: ^. E C L9 _) Selse
3 @7 k5 V7 L5 F8 g, k* n. W: t" }ns_marquee.left=marqueewidth+85 {1 W/ N% V9 k. ?
}5 E2 J4 q: M0 l+ X1 c3 R6 v1 J
}
5 H% Y/ ?" n5 _9 C& {
; @/ P3 H3 W9 ]7 G2 n ~& p* bif (iedom||document.layers){7 J$ V4 c; D- K5 y" Q
with (document){
* M; j/ j3 V& P3 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& Y" c" p" Z* F; J1 S- s: lif (iedom){6 I j$ p1 p, C/ w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& [2 v- a5 v2 a1 ?" n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% E: A! y5 s4 ~, s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 R+ G+ Z; p( ~* j9 ?, D
write('</div>')4 _; Y3 f* A2 x
}5 i9 G" z# {4 O& G7 F
else if (document.layers){6 v- J" R1 a6 m+ p3 D/ f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' `* S, x- c7 ~' s B0 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, Q) O8 f; j1 H8 P: Ewrite('</ilayer>')0 Y4 Q9 w& J4 F P& l
}
% s7 J" \ p8 u# hdocument.write('</td></table>')+ B; V* ]6 V- l- w1 O
}& u5 h; V$ q; x3 i+ K
}
. q1 q- p! A$ n7 @</script> |
|