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

|
网页之跑马灯文字特效
//修改宽度7 Y; `* R0 c! c, t, i! h: c
var marqueewidth=300! m! e* h9 B+ j* S& n$ F
//高度7 ~. U% W% B6 k- X
var marqueeheight=25
$ m! ?7 h' D8 i* K% t//速度(1-10)$ l( U& q5 @3 J- B/ m8 F. O# M; A
var marqueespeed=3
/ Q8 _8 I4 }" H//背景颜色6 I) V8 I9 \1 s& e& ?, Q- z% u
var marqueebgcolor="#FFFFFF"; f3 p+ L0 {+ ~
//是否能暂停 (0=no. 1=yes)?5 ?+ B: k! i5 t/ G0 M6 `; p2 m1 |
var pauseit=1
3 C0 i5 p1 i" U7 ]/ T3 s' `% e4 `' A( Z# V+ m U, U, D! f4 ?
//修改显示内容
' ]7 P: N" q0 q# J+ pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 R( I! C! n( P* p. t6 V& ~4 i5 T+ t% d- @* Z
/ T! f2 {5 h! \# |8 h5 f1 r
////下面不需改变////////////
, y5 G1 Z. a' O2 M1 e2 T+ i* C- M2 L' d0 j% W2 K, p* T$ y9 |# E, o" q
var copyspeed=marqueespeed
: `4 u. p! O; i1 t7 v9 c* h. \# N( Q$ Pvar pausespeed=(pauseit==0)? copyspeed: 0
+ _; @# L3 m5 evar iedom=document.all||document.getElementById0 G! N0 W& Q+ M" H' r* m X4 g. K
if (iedom)9 ~ y& L. m! ?' f% }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 G5 h1 G J6 Z9 w ?, P* g) \- [3 R
var actualwidth=''
: V2 i- j3 p; m- _* @var cross_marquee, ns_marquee, W$ \; z7 S3 p: ~: O7 H0 _: C: k
) {+ k" G" G; A1 Sfunction populate(){
/ L3 M3 p8 Z ]% u5 H) t# aif (iedom){) }+ L ]: T4 `1 e8 v3 j% S1 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 C) `" U# s( Q0 \) Xcross_marquee.style.left=marqueewidth+8, a' i' Z# b5 g2 h6 a3 b( w
cross_marquee.innerHTML=marqueecontent
0 N* N! |. k1 H& p& P" b8 \9 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* `3 K) f5 I& p- W o: V
}$ C( x+ l) ~ w# |" I" Y8 b; r7 ~* G
else if (document.layers){
4 B! U, S& j+ f- T0 ans_marquee=document.ns_marquee.document.ns_marquee2$ a" R! X Z( r( f' v
ns_marquee.left=marqueewidth+8
/ U, C2 x3 p8 _9 A0 r' Ans_marquee.document.write(marqueecontent)/ a2 p+ b. C5 L$ q& \6 U
ns_marquee.document.close()
' W+ n( v% x/ Q6 Y6 y; b# j$ Nactualwidth=ns_marquee.document.width
6 v& O7 L2 G x$ b: `}5 {8 j7 \: ]7 h) Y4 U8 Y
lefttime=setInterval("scrollmarquee()",20)
. m; I w0 m7 a* E$ e}
* H# @6 t$ U) N2 Q% `' Uwindow.onload=populate9 O+ H, ^% d, ?
/ A4 e$ D: j6 [1 @6 Zfunction scrollmarquee(){/ U! H$ @( L& P) \& Y
if (iedom){/ @2 \7 y0 V2 v/ q" |0 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. \8 m2 J! p+ ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 m( g6 \' E7 ~- xelse. O( F$ ~; E! C3 C$ \
cross_marquee.style.left=marqueewidth+8
6 U( v$ i8 g2 }1 \
( w( p! r) d$ z% Y+ f/ y8 [2 S) T' p2 z}
' v& q# o9 x5 Celse if (document.layers){, s O b9 Q1 q9 A7 Y
if (ns_marquee.left>(actualwidth*(-1)+8))
# J- [2 ]( A, `& x) ] xns_marquee.left-=copyspeed
) @' v9 l l: B! I3 Eelse: }4 C4 _( ]7 |( x" k5 y
ns_marquee.left=marqueewidth+8
0 l, e6 w* N& D; s2 u* w5 M}
9 y* ` |; I! }6 \, R7 |}6 O7 m3 D7 S1 J
( R* ]4 {/ k' S
if (iedom||document.layers){
% x, N1 [2 a5 U' k9 cwith (document){
9 Y- s" W; L. ]9 R$ Z) f/ Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 i& j: t3 P9 o" s* u0 C- s( D
if (iedom){
4 Y" O8 H1 m- ^3 [& Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& ^7 B6 W) f9 }3 q. X; [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 Q: t0 M4 X- ~7 V" x6 L: `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. G" ~! k! S1 {2 i; d9 ?1 Cwrite('</div>')/ E. C' x! S: G' U/ b
}
' h! p: q e' F" y- [4 x Oelse if (document.layers){
4 p5 w$ [+ }+ D9 zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); n$ H6 v: R( K3 t: m O, C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( P& U4 O( E3 s9 m' p7 c0 r; C
write('</ilayer>')3 v: [- w t0 V
}" V- D s+ n6 G1 G
document.write('</td></table>')$ c# K4 o# P8 Z6 r& s2 J
}% O6 {% A5 H1 o) Q2 H% h
}
* M. [' m( p' L8 V, f0 y3 Z</script> |
|