返回列表 发帖

网页之跑马灯文字特效

//修改宽度- |+ `0 V& e* p2 a3 k; X7 i. a
var marqueewidth=300' j, p! x, y9 w  @" d# a
//高度
2 a% G! s# U! x, @% mvar marqueeheight=257 x" a5 A% Y" l  E6 Q6 g. j" n7 v
//速度(1-10)9 Q4 x! m0 }- f) B8 X
var marqueespeed=3
( V9 G. H" I+ B- [! [//背景颜色
2 t9 w( }8 \) e& w, Yvar marqueebgcolor="#FFFFFF"
2 o) w2 G0 B2 v% m2 a# M//是否能暂停 (0=no. 1=yes)?
; M1 t1 N" q/ }, d% v$ dvar pauseit=1# e& D) g6 q$ m' D& q

7 U4 G- {( `9 c( O! ~0 o8 P//修改显示内容/ i. H' w' n8 w1 j* @% e+ Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ~  Z1 l4 r# _1 o. |

' V. `" M6 ?9 G5 j: B- t5 N' Y# q4 h8 M/ K
////下面不需改变////////////5 O6 B0 x: G0 y1 I! L

# L: I) X: k9 g! pvar copyspeed=marqueespeed
" p5 H8 B. L/ L, Z: N2 rvar pausespeed=(pauseit==0)? copyspeed: 0/ n6 V9 w, i: Y# w+ |  G* O
var iedom=document.all||document.getElementById7 D' V" e8 p  ]' b2 q
if (iedom)( w2 ~  J) l! i* g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% A7 r: j' p, E3 z7 gvar actualwidth=''* @. U1 G: H% O8 G
var cross_marquee, ns_marquee0 j1 U; G8 {8 T" o
: I$ c- j; F; w3 G- H
function populate(){
, T" v1 T8 d( k% I: [if (iedom){
+ Q0 y0 J' Q% K9 S- x1 w4 vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 R; e# |/ r, S" ]5 g
cross_marquee.style.left=marqueewidth+8, g0 \2 _& S8 p
cross_marquee.innerHTML=marqueecontent
9 J* B* T. _0 Z" Z* {8 C1 k6 p8 V' e/ ?8 qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& L1 |( N  N" X( I1 c7 M}. o# m4 Z; {! _. f( @2 M
else if (document.layers){  N% O% g3 r: t* o& X& V9 p
ns_marquee=document.ns_marquee.document.ns_marquee2
- w; S/ U5 f5 g) W$ wns_marquee.left=marqueewidth+88 C6 L4 V( h; d) p. x
ns_marquee.document.write(marqueecontent)
  J4 O* y# Q4 x& m4 o7 Dns_marquee.document.close(); g1 D2 F3 k. X
actualwidth=ns_marquee.document.width/ h# A: z4 A, x& ]7 ^
}
8 z1 V9 u) A( {lefttime=setInterval("scrollmarquee()",20)
  S( G. n4 \  B' x}
2 S$ p1 p: }/ |  O- `3 j2 x: awindow.onload=populate' t/ N# H5 Y* L( n- s+ F

* m: g- ^9 _6 L; I3 G3 Bfunction scrollmarquee(){5 s& v1 X$ t0 b! k2 T# B
if (iedom){6 x1 W2 C$ {5 M4 ]5 t8 ^0 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) p4 w, ^4 ]! m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 p6 E7 d( K3 j9 C4 N- d2 |" ]1 }
else1 q' ^' i' T/ j& d
cross_marquee.style.left=marqueewidth+8
9 i" C2 x/ p# b* ]6 N' P5 P# U: I
}
. h, P5 `) u  j- {! I6 Lelse if (document.layers){
( \, j0 N" [7 [. iif (ns_marquee.left>(actualwidth*(-1)+8))
1 M. b/ p! Y8 w% @  sns_marquee.left-=copyspeed8 n4 d: U8 c% ]5 n8 I4 O/ i
else
4 x2 A. U9 m7 J8 X! V% lns_marquee.left=marqueewidth+8
# W1 W# v/ A1 L6 q0 X}+ @, J- L7 N7 i4 `7 J. p
}
. L: N. W! r3 o. P1 |7 W$ M  |. v- V9 u5 [; l# J
if (iedom||document.layers){
6 N, R$ }8 u- |, Ewith (document){
5 v; ]  w) l' b# [3 [. fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 F% k/ v/ a0 T
if (iedom){, I2 M: Z( S) h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% C; |( P: s; s* ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 r. D) ]8 I* r" a; G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" ~8 k4 |* d8 N9 g
write('</div>')
4 f1 ]$ H; b* w! d1 u4 q}5 o3 F5 @8 t3 S& B7 J
else if (document.layers){9 Q8 V1 R1 {$ Y% @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 g7 q6 B) _$ p! [* {' ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& \/ N* R4 ?  V7 G
write('</ilayer>')
# |9 `" [1 }* W/ X$ K8 O( s}
8 G- L/ J4 J$ e! v" {, {2 b/ t5 Edocument.write('</td></table>')
) t( H9 z' b' h; F% r# l}: U: V4 f3 v5 w4 e+ A/ Q
}- _5 B; T5 L2 k+ L/ ?- @
</script>

返回列表
【捌玖网络】已经运行: