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

|
网页之跑马灯文字特效
//修改宽度4 |; J u( T5 A
var marqueewidth=3007 q% V0 l" r9 o& [. }- V% J: B
//高度$ m, r+ I2 C1 K0 t
var marqueeheight=25
2 a% x: u; }+ Q: f7 I6 K//速度(1-10)
: K2 Y' m8 ^' h7 m9 Tvar marqueespeed=3
6 [8 j3 b2 ` U6 ~1 v8 P, `* c//背景颜色
5 K( y+ D. U. r! d0 U, jvar marqueebgcolor="#FFFFFF"
) d- A T' t) n+ O/ l//是否能暂停 (0=no. 1=yes)?
( @5 {! C9 R* } W- q/ Z- a- A7 Pvar pauseit=1 d2 ]* X- W$ @2 C. b* r6 I: h2 n
0 [1 H1 e( E+ Y# }7 x
//修改显示内容
3 [$ ~ r. d* W- ^# z* p8 O4 }! Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 [) w5 e3 D2 A3 k" E
! K: ]1 X. Y" X7 g d8 n
- k! |! L9 o5 h3 |////下面不需改变////////////: z. r- v0 ]+ ~5 s% p- o3 E
2 D/ E3 D- j% N
var copyspeed=marqueespeed% t8 S. O& f( ?; @6 ?5 d' l
var pausespeed=(pauseit==0)? copyspeed: 0
]0 R4 h1 @: t; qvar iedom=document.all||document.getElementById
+ h; S7 V/ d" Oif (iedom)$ b4 t0 o7 a5 d( E1 V ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
~ h3 [' n! R- G. x+ f; h( i6 Xvar actualwidth=''7 i& j( T/ A2 c: `5 N. r
var cross_marquee, ns_marquee L* ?# h; w/ d+ ]
2 d! s* A0 x" H2 `/ i& ~7 s( ]- [
function populate(){
1 R \0 z' t! G+ v+ |" j, Dif (iedom){
$ }7 F7 K0 |! @8 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. c! t& {0 H3 ~% Q: a4 \
cross_marquee.style.left=marqueewidth+8
7 \& k- x. g3 |- s" ncross_marquee.innerHTML=marqueecontent. \& n4 r& E. R3 m8 @. w7 f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ B8 [) W$ _& F; p
}
@& T* G2 v" ~/ d' g/ Qelse if (document.layers){ E) @7 B* g" `9 z
ns_marquee=document.ns_marquee.document.ns_marquee2
; W& S* |; }8 Mns_marquee.left=marqueewidth+8
1 R9 q. ^ A6 I/ uns_marquee.document.write(marqueecontent)
6 T1 Y. N& H Vns_marquee.document.close()
2 z% I/ s! |# _! r% o" Oactualwidth=ns_marquee.document.width
6 K5 W) a6 S: k3 b7 Y}7 z/ y2 b+ \8 ?% F. L
lefttime=setInterval("scrollmarquee()",20)
$ u8 m( r/ {0 k7 \+ T}
2 ~9 ^7 r( H& ~' m5 ?1 w( Iwindow.onload=populate. o5 f" e/ m2 Z# f) f# r, l: @
" x2 v7 F0 U0 J# _
function scrollmarquee(){5 O$ j1 k1 }* Q( I" t* R# S. d
if (iedom){9 ]* W1 |, }, i2 [ a2 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, e/ g6 x- w/ G# m; j* w5 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 g7 z W" [& E( I; v# H
else
3 G# q$ R; j2 A* wcross_marquee.style.left=marqueewidth+8/ d: ^: B, Z# a( F$ h% e
: `3 s8 K- o0 T}6 J4 U4 T. J/ ^8 I3 E% v5 T
else if (document.layers){8 L& e! [- @/ Q0 U7 ^! |! r
if (ns_marquee.left>(actualwidth*(-1)+8)): q8 p0 @ j! P5 T0 f2 D( ?: ^
ns_marquee.left-=copyspeed- |( c6 {2 T- j. H6 v
else) K' c+ B+ u1 F7 o
ns_marquee.left=marqueewidth+8
# m. t5 J$ q# J; J/ v8 j* }}" S$ n$ O) C% W6 h# n6 S1 R' G$ E
}( ^# [: w" S" ^/ Q8 m/ N
' v$ H( P% u' m; R% ?- i3 U4 m3 ~if (iedom||document.layers){+ v1 U9 w* @1 X7 T: x0 y/ {# n' n
with (document){
: P! R$ `' [9 K: q8 h3 Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& ]9 E, {( ]+ v1 ~, oif (iedom){
0 G6 v! I5 E/ M+ cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 h% H- W$ ] U1 I4 b% y9 E# e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ R* e. i4 H; h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 `4 n z) l" @write('</div>')) b; [4 n! D9 o; z2 C+ h
}
( O+ H6 t1 c+ p. k2 F" ]$ {6 Zelse if (document.layers){
; o& t5 g1 c1 z, o9 a! j4 e5 u9 bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ k9 `/ _# g$ ?. D8 C: Q, Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# f: k* ?: Y0 P+ T, M9 E. G0 Owrite('</ilayer>')2 l8 j4 q6 V: F8 e1 { l( t: J
}2 X1 F w, V' O) G
document.write('</td></table>'): y2 ]: ]* C" i! N9 Y
}
X) f1 y, v# v- _" Z5 G% N# O}( q X, y& V k
</script> |
|