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

|
网页之跑马灯文字特效
//修改宽度2 Y9 E# u% U Z0 u5 N8 v' v
var marqueewidth=300
- n8 C* ?% U/ ^9 c/ u6 I. t//高度
! n0 v5 M, ]; S( j$ Kvar marqueeheight=25+ s4 }/ `/ e5 W7 o1 A& L
//速度(1-10)- J1 y: t( L; q v; v9 }( O
var marqueespeed=30 W5 q) k7 ~8 v4 n: |
//背景颜色
8 o* X k" d1 _; V4 wvar marqueebgcolor="#FFFFFF"
4 n% w7 J8 N- `0 y* p//是否能暂停 (0=no. 1=yes)?
/ U, \9 _; P. Pvar pauseit=1 l* [0 P# ?$ C* A( y
4 q; ]0 z; r* p/ M9 ~//修改显示内容3 v1 j5 B3 M c& U% x. s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 b5 H% {, i! t! M M
" d |+ } f6 T! y4 Y" P
& H( u' c Y1 J. O+ u- a////下面不需改变////////////
) C; O# G/ V1 Q; Q ~2 ~; w0 S1 A2 I
var copyspeed=marqueespeed. p9 B2 ]3 X8 {- H2 E
var pausespeed=(pauseit==0)? copyspeed: 0
\& I/ u0 t6 i- @$ b0 Jvar iedom=document.all||document.getElementById
& x& i! h2 d5 ?( fif (iedom)/ Z4 U% d S) ^* J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# L4 e. p- f, ^
var actualwidth=''% i Y/ g6 i# l* {% F) m1 I
var cross_marquee, ns_marquee
# r4 ^0 X' ?/ e9 c, F; }
2 }; N2 F; W5 z% z f: g- o) xfunction populate(){
9 u3 @9 k0 T; N6 Nif (iedom){) t3 r2 e" Y1 m2 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 e4 C: m- u J& x8 T+ \cross_marquee.style.left=marqueewidth+85 _9 O" m* Z* R" m8 m$ K
cross_marquee.innerHTML=marqueecontent
! f+ S# V! ~9 @$ `: gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; k/ _& b) J6 Q; D
}
$ q7 R) ]+ g. F. W# Telse if (document.layers){
" ~* ^ L7 o, b+ X% R# sns_marquee=document.ns_marquee.document.ns_marquee2
% B; Q( ?( V) R. `0 X: \# r6 Qns_marquee.left=marqueewidth+8
: u/ X/ \8 y& Q$ v! _/ kns_marquee.document.write(marqueecontent)- j7 y4 i2 x- C g
ns_marquee.document.close()
, g4 I: O$ J! Y& D# Oactualwidth=ns_marquee.document.width% x9 Q6 R1 `" C8 N% @/ ~1 M( B
}1 ~) Z" B c* ?: b! V' a
lefttime=setInterval("scrollmarquee()",20)+ j; D/ o: `! j. g( a' g
}0 j2 Z3 G6 j" i4 M
window.onload=populate; I" A: U/ o$ o" X7 R6 c( @
, t$ W c1 W0 m; v
function scrollmarquee(){5 G) L5 ^& b a- ~
if (iedom){
" h' ]6 T5 V" I0 [/ ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& X; ^" I+ i" Y' g. z7 Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ c+ @4 y) m. n' o' J/ o
else
$ B/ X& X0 X3 b% Fcross_marquee.style.left=marqueewidth+80 @! [2 F1 A- B
2 I8 C1 ^1 u, l% H3 x
}
9 U3 D* G1 L6 l+ c3 helse if (document.layers){* k/ _; C" `3 T8 G6 _
if (ns_marquee.left>(actualwidth*(-1)+8))
) T9 v! O+ M6 v. Qns_marquee.left-=copyspeed1 S5 K/ {0 t4 R# d( C
else( J6 b; t' y$ m ]7 q
ns_marquee.left=marqueewidth+8
* n" @. M: B' T, {$ ^# J}
# T' F( j5 o- K/ t' E5 i4 h3 F}
# I ? r5 m0 A2 ]& o
' S1 f t+ Q$ u* iif (iedom||document.layers){
. |& G6 X( Y3 B8 iwith (document){9 R: Z0 w5 J2 n4 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) l( k9 |9 E# E1 z- Q& c
if (iedom){+ n6 ^3 I* ?9 s" A+ x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ \# }. z' ^/ p/ bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') \% Z: _$ [- B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 v! k& ~: b; A2 K6 ~' w, e" H7 Vwrite('</div>'): j* A4 Q% z9 R2 v; |8 [
}
6 h, `( ~) y g+ g7 Melse if (document.layers){
b) m- t4 c) Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 D" y( g. s) Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 i7 V" P2 I4 J5 T8 o
write('</ilayer>')
$ m9 o. i) `" ^$ n0 r. t}
" l$ A2 S: p4 x2 V) jdocument.write('</td></table>')
) T7 E" P; E$ t: a4 R8 Q# F}
h( N8 B1 T: C. C. w}2 Y8 k7 Z {9 l4 S v2 Z
</script> |
|