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

|
网页之跑马灯文字特效
//修改宽度
! p' C6 c& c- l+ d m* m! pvar marqueewidth=300
) k' H h# N& V7 T' k$ t, U" M//高度
& ]5 y: |! Z0 ivar marqueeheight=25
% s. C: ^4 S7 n+ o& H L//速度(1-10)0 H. s4 j/ I3 E6 y$ R
var marqueespeed=31 V2 Y. b( d' n1 |. g$ n" c
//背景颜色
* y2 h; |' g1 H" Cvar marqueebgcolor="#FFFFFF"
; Y7 m" q/ P7 M//是否能暂停 (0=no. 1=yes)?. x1 {% [& u$ U) M" y+ V
var pauseit=1! S+ c' U0 |9 @
5 `7 {1 y7 x* B- n- ~
//修改显示内容
- K( G/ X* ?% }4 O. f$ Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': m# u7 C. n( P7 A" a1 m$ x
# ^; ~5 m4 L. {5 @! r# `" v7 T
6 |( ?- k5 v$ O- N/ b& k////下面不需改变////////////
^# {+ i' ` J: ?4 z5 G$ t& U4 J3 [9 S$ k+ t. p( b# H) q4 P
var copyspeed=marqueespeed6 V) ?5 s' \3 N' G# Q) D
var pausespeed=(pauseit==0)? copyspeed: 06 ^, j$ r4 ~" Q! z
var iedom=document.all||document.getElementById
2 H! T& v0 S- L& l# nif (iedom), O5 Y: V+ A! r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): U2 y1 {: N; J+ f3 b6 R6 i' B
var actualwidth=''
2 f/ Z) B3 [5 {" S3 |8 {var cross_marquee, ns_marquee+ \4 v2 B! c) j- t! h4 w
5 G, d2 a0 r9 M$ A) I$ Jfunction populate(){
6 O6 i0 ]% i: C2 C) zif (iedom){
( N; p9 x( u: bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 k5 n$ \- `9 m2 Ecross_marquee.style.left=marqueewidth+8
1 `: m$ d! E+ U0 t; B0 L6 x. m8 Zcross_marquee.innerHTML=marqueecontent) m( r" c, ]* `# r8 p# a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 x( E4 t7 K1 K9 U, h1 D) a) S3 k& y9 H0 i}
! M+ Z+ R) e: A- [4 `) s# ielse if (document.layers){
" O2 W' H: x( rns_marquee=document.ns_marquee.document.ns_marquee2
5 x# `, A/ P# m5 Wns_marquee.left=marqueewidth+8" c* P' R& L7 k+ z4 E
ns_marquee.document.write(marqueecontent)
( |8 ~7 Z5 t; cns_marquee.document.close()
1 i# M- d6 ?+ v, s. M, factualwidth=ns_marquee.document.width7 b5 q3 u, f6 f: R& v. t
}0 x$ x5 M% K$ W, ~
lefttime=setInterval("scrollmarquee()",20)
; l) p$ R* F. M$ u/ P}
# z9 o2 }: m' n1 |+ bwindow.onload=populate
; @8 S& t* L4 {" K2 L
" A# b5 `2 G7 ]; X7 Bfunction scrollmarquee(){0 q: M" [! u% p5 E5 `+ ?, ~
if (iedom){
4 B2 w0 C: J- ?" n) i# W% l' c5 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' C! O. C% T& ^; H0 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed l: ?0 ?6 ?: j! x0 _* p+ s. U
else
# y6 C7 e1 X7 lcross_marquee.style.left=marqueewidth+82 Y4 W9 D3 }5 \* W% z
/ d- q- ?7 x$ L# t
}
9 o Q. ?( B# q- Relse if (document.layers){1 i: p: `2 b3 ]4 A
if (ns_marquee.left>(actualwidth*(-1)+8))2 Y% E- ]% w$ V# ?+ {) p
ns_marquee.left-=copyspeed! x2 ]/ V. n% d# b- @% a' b [
else
. G k$ Z# r; b5 A2 g* r/ [ns_marquee.left=marqueewidth+8( q! }) m9 @. [
}0 m9 a9 O$ ^* Y3 {
}
1 Q& [) N$ H/ D! R7 @% e0 w' g+ Y* x
3 F3 w5 ^3 ]. Y$ w8 dif (iedom||document.layers){
+ r) a+ a2 F& k6 ~4 wwith (document){* t+ w; E# |( B' E/ ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% N8 M- d$ l' h5 s3 z- x$ U5 x: \
if (iedom){
* M, i+ {0 H8 b" n/ E$ mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- a; {2 [3 ?, {8 X( i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 z$ x& y8 e5 J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) z( d: X. e, D+ C C; B e5 y2 ~! pwrite('</div>')
* a( G- W' r) Y. S# s! ^3 b}
4 @/ L$ h/ X1 f' o& ?- ]else if (document.layers){
/ r, X0 K j0 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( L3 ^6 F! P- c& E4 ~/ K) A0 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') Z, e0 A# J5 E2 _! t! x
write('</ilayer>'): a+ @4 |& A+ x. |" _, N
}# m- J0 X& I1 P# e1 d; E
document.write('</td></table>')4 {# {, _& j& u* V0 Q: {
}3 q n9 r3 u. q' U, x& p
}
, ]9 N& e# q% _$ x: X) C; y</script> |
|