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

|
网页之跑马灯文字特效
//修改宽度
$ d# a( u: k# ~: c8 y4 a4 o) Jvar marqueewidth=300
' x7 h1 D' r* M ]) ?4 Y8 w) C; v g//高度) D! q2 w0 h& U# ~, l1 H
var marqueeheight=25
. q" @/ h6 g7 A) s. A: I, Q//速度(1-10)
( W" v1 |1 t) e( ]var marqueespeed=35 r9 _/ J2 i7 P+ C9 y
//背景颜色. a/ Z9 c+ }! r7 J2 Z6 z" n! Z" \
var marqueebgcolor="#FFFFFF"
7 s3 Q3 ^) g: o6 R//是否能暂停 (0=no. 1=yes)?
: p$ R, W* J) l4 @$ L; Zvar pauseit=18 U' q/ L( t' D( |
. a1 v" y' ~5 h% R% V' L8 T
//修改显示内容% S. n: n' l0 X" j% N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- L8 ?0 W2 e% l+ m
, O. L6 p( `* g; ]( S) `
4 {2 g6 `) d. ?8 Q* W$ ]////下面不需改变////////////
) ~: w G+ Q/ ]" U/ @1 b, }4 F8 _( C( ?% w4 v, P' N7 j
var copyspeed=marqueespeed K) a9 b+ h7 ~1 w) \3 W
var pausespeed=(pauseit==0)? copyspeed: 0
2 [ |' U3 J% p( }var iedom=document.all||document.getElementById1 d4 Y) y- _$ R7 I A
if (iedom)& j6 n! s8 q' ` j( m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, d- O8 t$ M% g. E! X8 ivar actualwidth='' A4 I$ R) t6 d& w6 X& t
var cross_marquee, ns_marquee
7 x0 h1 F' Q+ u. u2 _
7 Y! I8 d- |9 S8 ~2 X4 Rfunction populate(){
, x, G. _! j4 N! H6 G5 L3 g" t- }if (iedom){; C- T, n8 b# u T9 D0 x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( {( i6 S9 h% n) mcross_marquee.style.left=marqueewidth+8: l! G& u! H0 |# N: v* g2 M5 K; C
cross_marquee.innerHTML=marqueecontent% Q' @8 B8 ~5 u' B7 v0 b. _) p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& f9 \9 N4 v7 h. U! ?! v3 K}
1 n2 `& B! c" M% p# v& `else if (document.layers){3 f9 K% C4 Q# f. A% }# c6 Z
ns_marquee=document.ns_marquee.document.ns_marquee27 l+ v" l8 W- I/ g* I4 ?& b
ns_marquee.left=marqueewidth+8
: p% i' S L& e" z1 Y+ Q* ?ns_marquee.document.write(marqueecontent)
7 Z' N# v; `/ w$ ens_marquee.document.close()
* V1 a! @( L4 O! Z& ractualwidth=ns_marquee.document.width
/ i9 J" t" i1 J N4 D}
3 j: R8 q! I% ?- M& O9 l( tlefttime=setInterval("scrollmarquee()",20)
+ w6 y6 o$ d# i" a/ W' l}
5 S z! {) R7 Ywindow.onload=populate {* A5 f" @5 E9 Q( r
`2 e' [/ |& a0 bfunction scrollmarquee(){2 P7 H U: G& u
if (iedom){ u) B3 V6 q8 Z2 `7 ?& ~: \ U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) }+ G! W2 x m9 W4 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 j( _) H& ^; t* i4 r+ Y+ e9 n
else2 q1 \# a4 |# j1 r
cross_marquee.style.left=marqueewidth+8' y; ^) O( S2 [- V: H
/ m E# }; [( z( S, B* v
}
5 t9 i8 J s5 o! Y2 I2 ~else if (document.layers){; s. k% c Q$ [/ y
if (ns_marquee.left>(actualwidth*(-1)+8))
, Z; ] F, n3 b8 M: ^0 Wns_marquee.left-=copyspeed
. }( N6 l5 l$ M& e4 gelse
) Y! s$ Y# C- l* k# u) V. ?ns_marquee.left=marqueewidth+8
. ^0 U, o8 h9 E) v/ \5 J. ]}
; ]* D* W/ }* p! X! ~6 V3 r}/ k) U" M! r: {& }
% ~! c- F, ?0 T0 V( a Q4 M2 o
if (iedom||document.layers){6 ^% j/ N2 A8 k- n [
with (document){$ k9 _3 B& ]; e; c/ o7 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( m' U$ i" V# c4 D
if (iedom){
- O, J G3 S+ r2 u0 z* |$ i8 [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, x7 Z; k, O4 r. [. u+ F, Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ v" f- @) P# [ J$ e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# S* p% G" i+ Z7 M0 O% {write('</div>')+ i% `2 _6 p2 N+ V V! g/ Z5 z
}- g3 ^- P8 p% I1 O8 t d/ J! W
else if (document.layers){
! k9 J! l! I* _' Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( U0 z8 Y( }$ q5 A( x2 p( Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 ^/ d n: h% Uwrite('</ilayer>')5 ]9 V8 {$ S2 |
}1 O/ e1 u+ p- E+ K
document.write('</td></table>')
4 @7 c4 `+ G }; a- T, j} Z" e' j- }/ Z5 c6 R, \; z& ]
}3 i/ m/ v) d6 q
</script> |
|