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

|
网页之跑马灯文字特效
//修改宽度
$ w# w$ g. h5 @6 d+ w1 s j" Kvar marqueewidth=300+ b. P2 j7 n! `- Q! O
//高度
0 `6 g g; Q0 k( v% svar marqueeheight=25$ J& ?/ a1 d- c- Y
//速度(1-10)9 [% }" U0 m+ A
var marqueespeed=3* W. a& T9 i# K0 T: f' g
//背景颜色
% o* [/ i" [6 a- w( t; n) ^var marqueebgcolor="#FFFFFF"( p0 P, S5 |, W3 D
//是否能暂停 (0=no. 1=yes)?
2 e( K+ G' s" I, v# Qvar pauseit=1
/ B% S7 k/ ` C, j/ o+ l- h( J8 Z9 U9 g3 V
//修改显示内容
, K. K# v0 p3 o5 ?$ a X3 P3 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 V& z+ Z4 \) e8 t
3 _( s, A# V; T9 Q, T6 F U# y9 ]* ?6 ?1 @2 M
////下面不需改变////////////4 Z* }+ O: s' t
1 i: k$ V2 y- M/ {( pvar copyspeed=marqueespeed
W) x# W) A, y, Uvar pausespeed=(pauseit==0)? copyspeed: 0
7 ?- P0 B+ |- ~2 Y" rvar iedom=document.all||document.getElementById! }2 W$ p- G# _- U: r5 q
if (iedom)3 @6 e- G9 x, j' b7 b+ \0 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# z: o6 R) a" `* s0 N( f0 hvar actualwidth=''
- J; p7 Z4 K% k( V9 Hvar cross_marquee, ns_marquee
+ d& K7 F5 T1 M- e2 ]% d9 F
( j) N2 E& e H& pfunction populate(){8 o# x$ U) j9 v- o
if (iedom){
! w3 Q4 ]! V- H; ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" r& n0 D' V% i% w
cross_marquee.style.left=marqueewidth+8$ y5 [1 P! X% U0 B' ~
cross_marquee.innerHTML=marqueecontent8 x0 a" P) d% w( H! P6 Q+ ]* }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 U" p" o; o) a% J/ T: k/ T" L, m p}
3 Z# C) H% ^4 Y; Nelse if (document.layers){
3 J# Q8 [4 V% N- t: _ns_marquee=document.ns_marquee.document.ns_marquee2
7 q; A" W) K5 ans_marquee.left=marqueewidth+8+ @+ ]& u& p+ S) i+ n8 A% B
ns_marquee.document.write(marqueecontent)# m W. _( i" Z8 ]7 ^) s d7 k1 ^
ns_marquee.document.close()% T6 p% o4 L# t" O/ J9 c5 H9 ?/ s
actualwidth=ns_marquee.document.width
9 q, ?9 a" V9 g! p0 t; Q' e}
# u/ B. d# ]# k/ k& I" i5 v: ]lefttime=setInterval("scrollmarquee()",20)3 S+ w) M* q; M e L L
}; _4 x3 W: J6 h! l
window.onload=populate
6 z' P h/ ^- _4 H [; ~/ D3 l$ Z" k
* M% B( H. l- rfunction scrollmarquee(){ P& c, L. R" J
if (iedom){9 e& s$ D1 |0 w4 @9 ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( h) h i) N: r4 t/ S# Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
z2 u3 O( c* l; V; K% R9 relse0 \0 e6 a& ~0 Z
cross_marquee.style.left=marqueewidth+84 z1 t* l e9 W
/ c7 ^# \+ ^- l6 {, ^' `+ y& m1 |
}0 D1 M8 T; d' U4 X! B+ Q
else if (document.layers){
- J" @; f5 |6 q! B" Lif (ns_marquee.left>(actualwidth*(-1)+8))2 R2 x5 C5 s( Y0 O7 m8 i
ns_marquee.left-=copyspeed
/ h. v7 a0 q z+ q/ @else X" x6 s& ~! @
ns_marquee.left=marqueewidth+8
" L B, p8 e9 g0 ^7 y}6 _* h$ b) P9 Y3 p# I7 V) W
}* R. W- D, D! l6 M6 @
# K" J& e% F+ @' @if (iedom||document.layers){6 q9 D+ g/ R0 J1 j" E7 D
with (document){
/ s2 P# J1 S. H4 z! Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ S8 V! K; j f, S" B8 C, a1 j' Fif (iedom){
/ l" R( [% d8 M- awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' |: K: {* H) O0 p/ mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. t2 {% g# S7 \0 x3 Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! u1 j Q7 Z6 E _8 ]3 ?" ]# @
write('</div>')
# X- ~. z( d7 ^}3 H, V1 s7 W! g& W
else if (document.layers){
; X! K2 S1 B4 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) v. z; l3 g& F. s1 c1 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! R ]8 K( o9 ]* [
write('</ilayer>')8 Z C: p/ V7 G
}) x% k8 {% P# e% V$ v/ U8 L
document.write('</td></table>')( f' ~3 h7 O% S3 W- b: Z* h0 D
}
; R4 Q/ o+ c% |! W% K( G}- l$ V4 {3 W" q% b/ x
</script> |
|