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

|
网页之跑马灯文字特效
//修改宽度
$ f0 h$ R6 [2 Lvar marqueewidth=300
2 O3 F# {* H3 H% F! r8 ?//高度
+ h8 b! h2 V* Z: jvar marqueeheight=25! N* B% w7 ]2 v4 t5 Q. U
//速度(1-10)! }* U4 n% H1 e( P0 Z
var marqueespeed=3! ] a0 Z( W( A- ?
//背景颜色
/ L3 g& X9 v; Z$ Mvar marqueebgcolor="#FFFFFF"
5 R1 D9 O) ^5 V& ]1 S+ W1 O& ~7 j//是否能暂停 (0=no. 1=yes)?
' Y( g0 n# g- q+ j5 Bvar pauseit=18 O f' S0 E) ]* z
9 ?! s* o$ N" ~8 G6 b
//修改显示内容( M/ b8 a$ P3 o; K; b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! |4 g. ?) V( ~* a! h% d
, q6 X( i3 h4 Y3 ~9 p5 |* i: O# h0 X( B0 c
////下面不需改变////////////$ D8 Y" `8 T" K" I2 w/ _7 T$ y) ^
: b7 |1 S* t: k7 avar copyspeed=marqueespeed6 d. Z% B& Q+ f! J" N
var pausespeed=(pauseit==0)? copyspeed: 0
F; k# }) u4 `& {var iedom=document.all||document.getElementById
# t3 g% @4 h& H4 r. Xif (iedom)
% S5 j x1 X7 \6 r) I, Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 K5 F( I$ v1 \5 W, g9 y2 D
var actualwidth=''1 S8 H5 B) v6 |$ K+ q0 r1 ]2 I# q
var cross_marquee, ns_marquee
) Y: I3 K& Q6 L, l1 |' c2 O# ] h* V+ R6 r
function populate(){
) k1 X" U; P% l/ a) G r, aif (iedom){; b" S! r) X) Z0 T& L( P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& O- f: g/ S* G- ycross_marquee.style.left=marqueewidth+8
( V$ i: r! }1 M: l0 n5 rcross_marquee.innerHTML=marqueecontent1 S8 X. U' P8 W) `' I. b8 w$ x( n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* _ G: ~$ z$ w R( j: w" s}0 W- W M% W: S# X. W4 C
else if (document.layers){! h( l' G+ I) Y% A1 d0 ~
ns_marquee=document.ns_marquee.document.ns_marquee2
4 e/ c k7 U- f$ xns_marquee.left=marqueewidth+81 U, z- u \. a" S" O' I
ns_marquee.document.write(marqueecontent)
$ \8 `6 w$ I) K! ins_marquee.document.close()
* _4 H7 Z* [0 V/ dactualwidth=ns_marquee.document.width8 b! ~$ N* o0 a* |
}" h ~$ J/ m/ {: G7 ^
lefttime=setInterval("scrollmarquee()",20)
' N: ^# F; X! J( k4 L9 ]+ _}
?1 {& t( ` b$ d- zwindow.onload=populate
* r9 {9 T, {/ s! T @. y8 x- Y9 c' S; w
function scrollmarquee(){
1 T8 q4 P# g2 gif (iedom){
. |/ [; q: b# p! v Y% Q, g5 i$ Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, m A( S2 A/ w6 Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" Y/ }$ p. e$ q; f1 p5 ^$ `else
/ W4 {/ r4 t0 u+ Q& J9 y6 Ecross_marquee.style.left=marqueewidth+84 Z) c% p* x! _* j+ n9 p
- ^% `9 [7 _- y1 b6 y
}5 Q u% U; x7 P9 V
else if (document.layers){
# f4 u/ f1 X4 K$ Bif (ns_marquee.left>(actualwidth*(-1)+8))$ ~# J7 z5 v; M: g6 h3 U
ns_marquee.left-=copyspeed
- G. x+ p" I) q$ z& J& Kelse
9 a6 G2 i# C p" p1 h3 kns_marquee.left=marqueewidth+8' w5 i1 k- R5 r( D
}, W2 W( o- P2 x# B( N% |0 a
}
) U7 z7 s1 o& d# Z
* ?1 |: ] d! v; ~if (iedom||document.layers){/ k, t$ Y2 j7 _5 p6 Q0 P4 N' p$ D
with (document){( Z3 @9 ?) b8 ^+ ^7 s$ F8 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ }+ D" H, P2 W4 ~" Dif (iedom){* a( I$ k% s, W/ w9 e+ H. ~- \$ \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 E1 v4 f8 n0 E g/ R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ {1 n0 G0 X0 N, |* U( y, _" E; n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! ^# n8 K0 T6 c0 g6 @7 p2 w
write('</div>')
. Z- q5 Z# {* T' H" v! r5 A}
2 t' B; v2 z1 J5 F- selse if (document.layers){9 {9 h0 w6 }5 X* n d! |4 V, Z* m: M; o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* f- e8 }& O0 P* C, | p* _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 w: [: {) S5 T4 vwrite('</ilayer>')- ?7 V& E: a, p9 z1 r* o
}
* l4 e0 |9 G/ O0 pdocument.write('</td></table>')
# }/ s6 l* {9 Y. j}
( R) F" i. O6 `# R7 C}
& d- r, I8 Y, F) ], e! T- w+ I. n</script> |
|