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

|
网页之跑马灯文字特效
//修改宽度
- B U' @9 x' y, |! H. \# nvar marqueewidth=300
" V. e7 U- ^8 k6 [" D. q( t//高度
" p$ v1 Z' x. U9 Kvar marqueeheight=25
9 j; J/ N4 y( G% w" F+ f//速度(1-10)
7 R/ M Y* o; |: L, g0 m: t M/ Jvar marqueespeed=3
) \0 c0 `. j7 L J+ \; ]" h//背景颜色
' R: A9 k1 N B/ z) l! q) Lvar marqueebgcolor="#FFFFFF"
( {: @/ w) d3 N. ]! W//是否能暂停 (0=no. 1=yes)?
# }1 T Z' q3 M' qvar pauseit=1+ a! Q: y! d. t/ v# g# G
+ {1 ?" t: ~4 N6 u: m//修改显示内容3 {& O6 f; o% T8 ^4 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' J/ h: r- S4 }2 ?) _8 f
2 P( X# n2 j& D9 R0 ? n+ @/ W0 t8 J- h) V# O3 {. R$ w/ C; S
////下面不需改变////////////
& l/ N: W2 q3 [
; F6 M. h( u5 v! `/ Z! y* Avar copyspeed=marqueespeed
7 O% ?& b/ D9 \; L, Mvar pausespeed=(pauseit==0)? copyspeed: 01 k( f% i2 n0 C1 i; ]/ Q
var iedom=document.all||document.getElementById$ ^: ^# q& d! R- E* `
if (iedom)
# `8 i- p# N! i X! q. Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 Y. t6 r# S6 k6 p
var actualwidth=''6 |8 l3 R* \- h" w9 g
var cross_marquee, ns_marquee
; L: l$ x' |! P. }# R
! J4 t9 f" L& j- Lfunction populate(){: `+ d' k, s+ Q A
if (iedom){$ }+ B$ E5 j' q: Z3 [# \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, U: a# q4 }5 l! g' ]/ _+ Pcross_marquee.style.left=marqueewidth+8
0 Y n6 R8 L9 o+ [' ~cross_marquee.innerHTML=marqueecontent
. ?! E2 E: Z( s" o& E4 x3 s% Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth j8 _0 y0 F9 t5 [
}4 V/ \- ^, v, }( o% c4 f
else if (document.layers){
9 y2 r7 `8 ]; E6 U Gns_marquee=document.ns_marquee.document.ns_marquee2/ x! z1 e( ^7 j. O- h
ns_marquee.left=marqueewidth+8
5 ]* o- a# X2 J& pns_marquee.document.write(marqueecontent)
$ t- g; p! W6 H- }" R, r. vns_marquee.document.close()# [3 `" w6 p' V- t+ ~: @
actualwidth=ns_marquee.document.width
6 |& B7 y4 {) C* M; H X; V}
! l; \- q. W3 c2 f( L- Nlefttime=setInterval("scrollmarquee()",20)0 _! g9 K" Z; b4 b5 n: @0 v
}
0 E& G; n5 T. Y% Owindow.onload=populate
3 k: y9 W5 ~" e8 H. y0 d H
" k7 i6 U3 b w3 Y0 X& V7 s3 j4 zfunction scrollmarquee(){4 R* h$ ~7 [. [' k* C/ E0 O8 E
if (iedom){/ e$ A+ v9 v5 ~( z8 @. Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): T; e6 ^% f, x" R) i7 o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) F7 K5 Q, E$ [ Belse3 v, k* y0 z: X
cross_marquee.style.left=marqueewidth+8! }$ q8 H9 G* D" \
) i' Y1 G3 m2 H: b5 [}
# c i4 Q5 _: r6 t6 Q+ g" I4 ]else if (document.layers){- a$ W8 q; C! i& e
if (ns_marquee.left>(actualwidth*(-1)+8))
5 k* B% V5 O7 a5 c$ pns_marquee.left-=copyspeed
* [/ d( a3 }- @0 `$ Z' Helse
* Q$ |1 z$ Z; Ans_marquee.left=marqueewidth+85 F4 F& Q. Z6 X
}
5 h& Z$ B: _4 ?3 u, t}
- v: v2 f3 W: F$ V( `6 ] y/ K3 n% C P7 J! y0 \- i
if (iedom||document.layers){# Q) z0 `+ k5 @$ h( z0 s
with (document){
4 M% y- I$ M2 X6 Z3 M- Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 J/ Y) |/ C/ t; |; F* ] Mif (iedom){' f: r1 R+ H+ |2 U) b3 a7 s( n, P# h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& d, \/ I) ?, a2 d- d& K; I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( u- B+ f# k0 g' `3 s% x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" |$ [' w3 `0 u! H' C7 z
write('</div>')
) ^2 |0 c- ?- ~6 j4 G}3 X _8 }- P% E3 [( k0 j/ y
else if (document.layers){2 n5 s& J3 N9 g6 w# ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 |# o) d1 i4 ~8 Y8 T4 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) D2 E. O9 K" r- ?# s" M/ o
write('</ilayer>')5 R# w8 U! U9 U: ^9 Q
}
" u& y, [$ n @9 V$ r; ndocument.write('</td></table>')
: Q3 S1 d6 U! G6 N! i}
t! {- t$ f( `9 a}$ t6 ?& y# T1 B7 I6 k& t
</script> |
|