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

|
网页之跑马灯文字特效
//修改宽度, u- b8 k* S* N+ b* x/ O
var marqueewidth=300* A( q7 Z" G6 g1 u! Y s5 [
//高度
$ i& h/ ^. i" ]var marqueeheight=255 U! m. U+ n) f4 X; f, y
//速度(1-10). ?0 l9 E- A1 f& ^8 j3 k% c. A
var marqueespeed=3
' C9 ~- u6 n3 I1 e) |//背景颜色. S+ c: t( M1 t
var marqueebgcolor="#FFFFFF"
: V3 d4 e, ?' S//是否能暂停 (0=no. 1=yes)?" m+ Q3 }' y; f( _1 y/ w
var pauseit=1
+ o8 \ v Z( y5 t
$ q* u. z X0 b9 H; c" |3 [/ \7 S//修改显示内容
' A$ |& g) K4 P8 Z3 t* J( vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 e1 m. _* C8 C, z8 Y- l& k6 l
6 j( k' ?3 A1 w! k8 j
) Y4 ?: M& j& e: m4 W////下面不需改变////////////# n! G2 V5 `8 [( x1 T
, R9 B5 i# a) {% Evar copyspeed=marqueespeed
. u" c. W7 h K" J- }var pausespeed=(pauseit==0)? copyspeed: 08 P& T ^) ], @9 v
var iedom=document.all||document.getElementById
! b# s: k+ \, O& gif (iedom)
# ?* k( H+ ]! U4 x# M: I4 k( L: ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% l9 q% Z. n; t
var actualwidth=''
1 k3 m# G2 d5 m J: _" ?var cross_marquee, ns_marquee5 _4 V" I- |' Q: m* X; o8 }$ `! I
1 g' N! o+ U7 {4 b, h' @! I
function populate(){( _( u1 D( z. ?; t+ y. s$ `
if (iedom){
% B* e, u8 h% K+ \: c2 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. e5 C; x$ a, O
cross_marquee.style.left=marqueewidth+8
% s+ v2 \; r- l/ l( H [/ I9 Ecross_marquee.innerHTML=marqueecontent5 {. [' [" R) Y" x$ Y" o, |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 W1 e' g; F& ]$ N- }" F}
8 s, x9 B) }2 `7 m- h6 Uelse if (document.layers){3 e$ E4 L+ k$ e. [- S( ?% x4 X
ns_marquee=document.ns_marquee.document.ns_marquee26 u! e+ i) ?. I. i' b }9 j- p
ns_marquee.left=marqueewidth+8 ^( s; D# F4 _/ m5 n Q2 o1 |
ns_marquee.document.write(marqueecontent). Q: i: x" x, T! s3 Q: m+ T
ns_marquee.document.close()9 y ^. ?. q" ~. h$ s, X3 q5 l$ |
actualwidth=ns_marquee.document.width
3 G# s* p% j: e( a. t7 K}, t4 ^6 e- N8 Q3 J5 D- `
lefttime=setInterval("scrollmarquee()",20)
5 S9 J' X ]/ [! D0 e( v; b% ?' @}
1 e; R& V' ^8 ^7 `& r- l! x/ z) Pwindow.onload=populate! q' Y6 O5 f& l% k
3 x- ~9 I W; k0 m9 C5 @7 ~function scrollmarquee(){( G# o1 b1 b: v+ A
if (iedom){
+ q$ J1 N; r0 {1 Y. yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' K6 G D v+ e! z- |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; _- q" v. ^( k$ j5 Gelse( D8 _' ]8 D/ e
cross_marquee.style.left=marqueewidth+89 i8 g+ |, J# m3 D4 S7 m: p# L
7 B* @7 r5 @; W; S r
}* D+ @8 u6 m2 d. _- o) K
else if (document.layers){8 Z/ y4 b; J' T" S( Y% w
if (ns_marquee.left>(actualwidth*(-1)+8))+ [! V# r: d7 o: i+ }% `
ns_marquee.left-=copyspeed7 {: v1 f4 H2 `) P
else
k3 G) ^: ^( P e6 l: l4 b9 G, {ns_marquee.left=marqueewidth+8' J7 d5 W# ?4 R. L# J
}
, d+ _+ O9 H- ]$ B+ z8 C* i* C}0 V- X( C7 `/ Z4 n I
7 l7 d5 T6 g# Z, \9 hif (iedom||document.layers){8 d& K1 `6 B* i5 t3 ?$ K5 D) A4 X
with (document){
! e0 |6 G) C* `% r0 `* W7 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: r. h' g& K7 y& t) zif (iedom){
: J; [; e/ p2 u- j9 Z1 H& l) \2 Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 Y. n! H1 I+ ` w$ \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 a# z, _5 p+ j4 t# m% T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 g& ^# F! }" m9 {- _
write('</div>'); H8 _+ [1 ~( ~1 s
}2 @. t& ` m- c3 o% ?' U% }9 H
else if (document.layers){% }6 B4 `4 ?6 l8 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 q. h" N2 x4 G) [9 f( }5 u! C1 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- Z2 B( Z6 `7 u( B* ^. g: C
write('</ilayer>'). G, ~* O% Q9 M) E9 O9 G* P$ \
}' d/ r3 Q$ d# K
document.write('</td></table>')
. Z2 [( Y2 k+ a- L: x. O: j}
4 o4 f A5 |" w3 w7 l$ D: {1 D+ G* k7 B}
: {4 M0 K" S. l3 {</script> |
|