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

|
网页之跑马灯文字特效
//修改宽度
0 h. c) i! y+ R( I) m ?! ~var marqueewidth=300
4 Y. W! O# \' k8 P7 r" f//高度
- I# p' C/ `8 w' o! }, c& Rvar marqueeheight=25
& u; {6 c4 Z# p0 I//速度(1-10)
) d+ c. b+ L3 t. ?5 l: } i! @. V9 ~var marqueespeed=3/ g: @3 i. b% `7 q% k* w2 C
//背景颜色
" U5 N% I! ^( |2 Q; I$ O4 Tvar marqueebgcolor="#FFFFFF"6 w7 t" v0 c+ J+ B6 u. \
//是否能暂停 (0=no. 1=yes)?
0 T& ?$ P; s" W% ]4 Pvar pauseit=1& ?/ U# X1 \) ^: k- T$ y
) q0 h3 R/ P! ^7 I//修改显示内容
3 K* O7 T3 F- A3 x$ i/ j- Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 ^/ R+ q1 I) d6 A5 g, f
* g' J6 ?; U C: v3 ^
0 C& f8 a0 X* W0 E( ^! O S2 Y////下面不需改变////////////! G1 w8 M2 A0 u/ c. U/ q
# \: j# l( r2 w9 b5 D$ n5 K
var copyspeed=marqueespeed
" Y5 U; E: Z2 O1 q" Xvar pausespeed=(pauseit==0)? copyspeed: 0
3 u5 w- I0 e& m! N0 T- X0 lvar iedom=document.all||document.getElementById2 o# x3 H; ~7 n: z8 }# R K
if (iedom)3 X+ }# \1 F: g" r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) p0 N2 B9 c! X# l7 H& k& g) _
var actualwidth='' m" v) v+ s2 {+ Z+ A5 ?% b
var cross_marquee, ns_marquee
% A- \% n( ^) x- U5 q6 [' m# m6 Z. c8 S1 q4 R) P+ w
function populate(){
; O( {3 j( Z% U' a& d0 [if (iedom){
5 }9 _# J6 |" i( V" n6 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, y$ G7 C) q5 o' G! Z0 a
cross_marquee.style.left=marqueewidth+8. d2 U4 j+ Y# o6 }- A; ]
cross_marquee.innerHTML=marqueecontent5 G' s3 j9 Z: _7 {( v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: }" t- y# L8 a6 M) _% v+ u& k
}
0 Q; i( K2 K! @! h; B; ?else if (document.layers){
5 p1 c! t. ]6 E8 j6 g5 v4 wns_marquee=document.ns_marquee.document.ns_marquee2
9 [0 s6 H0 p& l, Pns_marquee.left=marqueewidth+8
( W: q0 j! T& Tns_marquee.document.write(marqueecontent)
) L! X2 r3 v' x# f3 ans_marquee.document.close()* B' O! ~6 f' w
actualwidth=ns_marquee.document.width9 `- U- @& R% A( l- U* X1 U
}$ r9 z T9 t9 s- w# B
lefttime=setInterval("scrollmarquee()",20)
1 F0 G3 j& }. o) o}
$ W n& K+ A3 _window.onload=populate
0 z/ m2 ^2 v5 n( h
% r9 |0 x( x) b6 jfunction scrollmarquee(){& [, q7 i; }( I$ q+ E1 z+ v- j& m
if (iedom){# j1 f& E; j# Y$ U3 D& ]5 r4 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 x3 Q1 I7 w0 k% O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ |0 N& ]: }+ o; Y/ _* F- `
else6 H4 p7 z. P: i
cross_marquee.style.left=marqueewidth+8. k+ K5 W e! K( K
: h& F' P8 m! j' h& a/ B: H}
& W L/ V6 c5 U5 Ielse if (document.layers){4 t) e$ A% j5 w4 j! x6 e/ d9 m a( I
if (ns_marquee.left>(actualwidth*(-1)+8))& ~2 u3 u3 i: u
ns_marquee.left-=copyspeed& P* A' g6 L5 p& j
else* T& ]0 I6 j5 m" `
ns_marquee.left=marqueewidth+8* ?# N1 W7 Z) ]8 L
}/ N% f4 U: r# j; C9 z
}: r! Y/ `4 K9 [
2 L% e. U1 R) E5 N; p) Vif (iedom||document.layers){1 J1 d2 N R9 u7 l4 h6 _% o
with (document){0 F$ D' c7 D0 U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
w5 V$ n6 C+ p+ D# ]if (iedom){
0 r& I$ z$ j# [9 ^8 j$ I4 Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; C! U, h" y0 L0 Q% o( O7 Y% R pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 y. E) I4 m" \4 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* e- f5 s$ B6 k/ \: s2 D. twrite('</div>')
% p/ p" o9 P z9 {: X! S" a& w}
& _7 T- H2 I( Ielse if (document.layers){5 M+ {6 y ^1 \! ?; [) s. j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* B# o$ t: l4 `: g2 g! kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ P/ @+ }, C1 N1 \2 ]( Vwrite('</ilayer>')
1 J9 n+ F, O5 m) b) R8 O f# j}4 X1 @) z$ V1 r: c6 z9 \) v4 \
document.write('</td></table>')
! s9 _6 z' I8 H}
7 E0 A) R1 L( Y8 ~* n( G6 Y}0 a2 K6 W2 g# U$ k
</script> |
|