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

|
网页之跑马灯文字特效
//修改宽度, D3 j A& P- ~' O# i$ A8 \
var marqueewidth=300+ v3 b8 e. f+ Q x
//高度7 @& y/ J, M2 ~3 H1 ?5 { d( h7 M
var marqueeheight=25
4 ~& A0 Y5 ^3 O0 t# c6 r//速度(1-10)
( `' F* J9 z, J, \var marqueespeed=3
4 L/ Y# L9 g6 x( o$ b$ u9 x9 c//背景颜色0 w, K. l3 f4 p5 W# P
var marqueebgcolor="#FFFFFF"
6 {# e2 f: r* x3 q; d2 ?//是否能暂停 (0=no. 1=yes)?
: a% `' G7 c* i/ d$ Lvar pauseit=11 s7 I" |; y3 n/ D
! X5 _1 T! i& R//修改显示内容
$ B& y+ ~9 h$ ?* C$ F7 S2 e; ?0 xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: |! @' R9 k# }
; v! ?2 X) L5 r2 y. E) H1 ^5 g9 ?# C' ?. @' }
////下面不需改变////////////+ C3 ?8 H o# i9 ?
! v* \. J' h: r/ a- ?var copyspeed=marqueespeed7 x# A3 U$ g5 S+ K( u2 \. t& j
var pausespeed=(pauseit==0)? copyspeed: 0 l' ?; \( g- H5 j J; e" D' ~
var iedom=document.all||document.getElementById g( R% q1 [, _: k
if (iedom) P& j) V4 f' ]6 K- B, q/ L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# n0 G! X& X3 h; p" @8 a; r- v
var actualwidth=''
$ Y$ O( O5 ]$ ]- b8 h* f! j0 hvar cross_marquee, ns_marquee
O8 G+ ~: F& r% e3 U5 Q# s |4 h1 ^$ D, S5 n9 r
function populate(){! c" ^- p& I) O. D0 \
if (iedom){
9 T) G/ b' o1 rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; w: Y2 c/ r/ gcross_marquee.style.left=marqueewidth+8! q- N/ |5 O- o! J' |
cross_marquee.innerHTML=marqueecontent
- M! p E- N, y- p! ]+ D6 Y8 |' {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: W4 o6 I$ J6 |1 |}
; c- Z* N5 s W- L& w) D @else if (document.layers){
$ e' e( C7 B+ ` lns_marquee=document.ns_marquee.document.ns_marquee2
9 U8 A* ]7 F) `6 U: @ns_marquee.left=marqueewidth+8
4 L8 n3 f* V0 ]9 m4 ~3 g+ T' ?: ons_marquee.document.write(marqueecontent) W, o( s- s1 t, {1 B
ns_marquee.document.close()
# \" a" h) p0 Eactualwidth=ns_marquee.document.width
; ] Q; W u2 I7 I# ]}9 h5 Z+ B# l" [: J, s o5 T1 U
lefttime=setInterval("scrollmarquee()",20)! R( u- g( p% R, d9 Z
}# X3 g$ w& N% s6 i/ K
window.onload=populate
. @! E: I2 I9 j' ]6 O/ M2 \. E D# `* }4 G e5 l/ x. }
function scrollmarquee(){
! {* ?0 q" P/ _6 L- |if (iedom){
# ^& ?/ Q& k) I- o |0 Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! p& p; |. k& e( f$ Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ S; K, q2 Z$ V$ J7 z. uelse ^8 P( M* _: P1 n
cross_marquee.style.left=marqueewidth+8
" X3 k- Z# _, r% a" v4 G
% I) g7 |8 z+ c; c# V4 i% X}) [ I( Y" q5 Z
else if (document.layers){1 R' U; e C# n7 o# v/ L f
if (ns_marquee.left>(actualwidth*(-1)+8))
" r5 Z- p6 R" Q4 c; r* }$ Ens_marquee.left-=copyspeed
* G* t# g/ M/ ^' X5 g0 c; P& celse
) j7 O# n# u- j- zns_marquee.left=marqueewidth+8
" q; e" o4 n6 T" V8 {( h0 T9 R}
" D/ }, @8 Y3 W; D: p) n$ J+ R}
( P# U% {: Q. h9 j8 _2 h+ ~/ Z4 V: e! L4 H
if (iedom||document.layers){" R% p* B7 I* D
with (document){
9 W! G6 }# _1 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' x4 O3 p4 h: M+ e" wif (iedom){
$ s2 [' z; `+ P: ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). u/ j7 v5 ], G E9 z/ d4 ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& x- ]: [% M) V4 \1 p+ V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! n8 G+ I/ t- r+ E. k, i8 K: W8 t v# }
write('</div>')+ y& M% |8 q( r: z/ I# V8 q6 a/ |
}' A& Y: |. l" h! j6 `$ l
else if (document.layers){
U! ?: L r' \: a4 y6 Z9 O: iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( z5 J. W) [" h6 ?5 v0 }8 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( w% Q. D* N) \; Cwrite('</ilayer>')- O1 H5 b( a9 I: ~
}
" ?6 @) } i7 b- A1 Edocument.write('</td></table>'); q, [5 X2 C. j6 q7 x
}
2 i, _1 y9 ?0 O( _8 P n: e}$ A9 H# Q3 h$ |! e. N$ w
</script> |
|