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

|
网页之跑马灯文字特效
//修改宽度
: l0 A+ a l: I; }0 Z$ xvar marqueewidth=300
- n( e/ ~ H- N% p/ ]) p//高度- |" N# H3 _6 v$ r5 a
var marqueeheight=258 f% T( w) p5 l+ E( S- }
//速度(1-10)* B5 F' j+ t5 O( s- [ K! c
var marqueespeed=35 V- P* E( w- b: R
//背景颜色
) o4 _ {% F |( G+ s8 c9 d" ivar marqueebgcolor="#FFFFFF"9 ?3 S# }" _8 d
//是否能暂停 (0=no. 1=yes)?* Z) A/ G- K" g3 H' o3 K
var pauseit=1
$ i2 v" o& {- u( ~" y$ B: ?7 h# b# P+ t' D
//修改显示内容" p* E# d$ o; `+ {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 R$ l7 w4 {0 w/ u/ B9 L9 E
4 T( ^" B. ?; c/ Z% E2 x' b3 m0 q7 D; m4 I" o! _
////下面不需改变//////////// p9 o% ^* G- J7 j
, v. B8 X% V8 z
var copyspeed=marqueespeed
3 T# ^! X) n/ g, q1 p, xvar pausespeed=(pauseit==0)? copyspeed: 0
# H9 W& R G0 b3 tvar iedom=document.all||document.getElementById
4 }5 Y% `- y, i9 @8 ?% ?- Zif (iedom), p2 v& G' {$ Y+ Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), M, B: C$ p& a- Z
var actualwidth=''; T% P5 X: |" c
var cross_marquee, ns_marquee
: S9 K1 X5 @% _6 _1 N4 R. Y5 ], M1 ?
. o, \. o8 q1 m' j6 E( {function populate(){
+ d# r1 k3 p/ Bif (iedom){! _0 [4 m2 V) C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 [: l- d$ e5 [( z: U. x
cross_marquee.style.left=marqueewidth+8; E$ |+ s1 ?: t
cross_marquee.innerHTML=marqueecontent
0 S2 F( c4 V( u2 l/ H" T7 |2 J. B* mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- {4 ?0 [ i( f: W9 l
}
- ]( |3 F4 ^* N( velse if (document.layers){: N5 Z# V3 ]/ k
ns_marquee=document.ns_marquee.document.ns_marquee2
1 M- V: k$ D$ o! J ?6 |ns_marquee.left=marqueewidth+8
8 ^4 u( U- K8 O+ ^0 b+ _) Hns_marquee.document.write(marqueecontent)/ G( ]% n, x; |4 U$ J
ns_marquee.document.close()9 ] }9 a `# c* A
actualwidth=ns_marquee.document.width8 o R$ V( c3 O3 Y2 g& W
}" n6 H0 f# V: T0 X6 C: h
lefttime=setInterval("scrollmarquee()",20)- R- v( Y* ?- C1 T" D3 Y6 j
}5 A! T* k; E& Q: m
window.onload=populate) e5 T( J: h d) q
3 A& ~ P# K6 y3 v
function scrollmarquee(){7 p0 j+ U, g6 o( i
if (iedom){
; L& _) W3 R* ^. Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' ~* ]. a+ R' v4 l- F! |. E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ J- @; h" Q* ?' j& Q2 d& U6 Kelse" b ?* k4 z/ i5 P& J6 \7 u+ q7 I
cross_marquee.style.left=marqueewidth+8 O% Y* M( b: @: q
4 ~8 V: I; C/ ~0 r}
1 O( ~7 ~3 M5 }- Y7 helse if (document.layers){
" G |, N& N, z- h* Mif (ns_marquee.left>(actualwidth*(-1)+8))) b- |" B! `2 G* C6 d" Z
ns_marquee.left-=copyspeed: e0 M. O+ V* h/ O0 C
else0 W% @- j- S: A: o
ns_marquee.left=marqueewidth+8- D" q) M5 M7 ]
}3 [& J) T4 Q0 z- g) u! A
}5 m$ [# }- C2 M6 P& U/ x1 @
" }: E5 q0 ]9 c# k% a/ d
if (iedom||document.layers){8 [3 h2 W6 S' M8 l+ D
with (document){0 [8 }# i/ F* j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 S% j; m8 D) nif (iedom){
5 S: r+ r7 c' G. K9 D, }8 I4 R" S( ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" A5 `. Y, s! F: I+ n1 C* n/ o' W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 ^6 b4 Y" L% s M9 t; }% X: ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 i, m8 c( s8 R; O
write('</div>')) l# s$ B' E( J @7 K2 Q7 g# m2 W
}
2 C# {& \4 w% z6 Y& Oelse if (document.layers){% \8 {+ J ` f% n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): W- d1 O: {5 C8 e6 ]/ _! t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% r6 w! @! L$ M h3 dwrite('</ilayer>'); m2 e/ T: A! K7 F5 d
}( ?2 d* s2 u6 h# n. D
document.write('</td></table>'); f4 X% ]4 O/ }. m
}
; a. P- J1 F6 u) I- [/ h% q. Q}
; X: c, L' O- D% E# \# X: ~7 u% w</script> |
|