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

|
网页之跑马灯文字特效
//修改宽度
. A# v$ B: Y# g* b) S% ?var marqueewidth=300
: e) ?7 s- Y: C1 `9 G8 ?//高度
6 B6 m- P2 f6 S# p9 Pvar marqueeheight=25
5 E$ G' b1 ] r, E" S4 ?//速度(1-10)
1 q q! l2 _) d1 d) j* j9 `/ }4 zvar marqueespeed=3# l. I( H9 q2 f; {
//背景颜色
6 _/ E5 A3 M- l6 Xvar marqueebgcolor="#FFFFFF": k4 ~, o7 R% S5 d. o8 K3 E; h
//是否能暂停 (0=no. 1=yes)?
$ l) I' C: p( h, dvar pauseit=1
9 }0 `8 @; ^1 q6 a+ l7 X0 R9 H9 h8 r4 C+ O6 O
//修改显示内容; x$ L6 t0 W" r% N* J8 l* w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" ~7 c2 G' C, Q9 k! m3 B/ M! a" S+ v$ O- K5 o8 _
1 k$ q7 K3 H+ c- o7 F2 [" ?
////下面不需改变////////////
6 O6 B5 a3 c5 R, w9 {
! }4 d( f( R2 r6 E7 Y" Avar copyspeed=marqueespeed; m" ^/ V: y0 y0 D2 p, ^: b
var pausespeed=(pauseit==0)? copyspeed: 0# W" S1 t; L& d3 o
var iedom=document.all||document.getElementById
) N7 r; G& r4 q# hif (iedom)
' T0 A9 |% x" m- f2 y1 M" zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
F$ q' {7 a7 B; ]% [var actualwidth=''
6 S) v8 ?+ S+ J8 M C7 y& lvar cross_marquee, ns_marquee
1 f' w _' X5 j' V/ K! Z+ v% N: m" P
( b9 E T9 S8 Vfunction populate(){% k1 u3 w% a8 q
if (iedom){! k% t$ @* z/ n2 \; N/ Q8 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 V8 \ ~% g0 C- p( S
cross_marquee.style.left=marqueewidth+86 d; S# b3 T; Z/ F6 s3 h1 d
cross_marquee.innerHTML=marqueecontent
) s% q b* r: W3 w! qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 K3 D5 z0 _" g# D! U}( [3 ~6 D( i% Z, z
else if (document.layers){! x$ O! O4 l3 ]- Q. P4 a, C0 r
ns_marquee=document.ns_marquee.document.ns_marquee23 O) b( C+ [- W- Y1 ^0 n
ns_marquee.left=marqueewidth+8
9 \0 z8 O6 M: q, Rns_marquee.document.write(marqueecontent)
; g( \( R& `9 j- q/ ons_marquee.document.close()
% \$ M2 t6 T( l$ M# Bactualwidth=ns_marquee.document.width7 q! Z9 M/ ^& T' `& r. M
}9 N, T$ J4 d& I$ }
lefttime=setInterval("scrollmarquee()",20)
0 U- y; e& V$ C C}
* b$ T2 a' N# Awindow.onload=populate
5 q2 f ]/ V$ L* u
3 n8 k. d" u3 f+ pfunction scrollmarquee(){
3 o$ [2 Z' q' iif (iedom){8 b/ Z. k: `, J* t/ Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 p) X" {. b- @) _) Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. E2 p( Q" ?+ x, Y/ @+ ^else
$ W) D; _7 s. G! G. [cross_marquee.style.left=marqueewidth+8
" i( X; k4 r* O0 l2 c! y7 B9 w
$ J, F6 O/ a! S}
" y' g7 `6 ]5 F8 P: Xelse if (document.layers){
, v0 _4 p6 [' j% [2 }( zif (ns_marquee.left>(actualwidth*(-1)+8))" y& U" X& Z6 N9 P& R6 H$ T
ns_marquee.left-=copyspeed2 ~. \; i9 R5 L8 f( x) e! _* [& F
else+ L! I6 I. Z, [. a6 i
ns_marquee.left=marqueewidth+8- P- t8 b: {) P
}
- M: H) z- Z H3 G& Y5 q4 e}" }% S. @, U1 K
; T( a) ~$ S/ n% dif (iedom||document.layers){6 x8 w4 B# e$ |6 h
with (document){, A& G7 z+ {) _) Z9 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 x7 c, O' k' `1 ^: X
if (iedom){
1 W# ~: Y; d: |$ \2 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( [. D; j& W9 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ {; q" [ T0 P0 E b" C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 m3 N7 O2 l- a a: R5 J7 Pwrite('</div>')8 W; e9 ]: S3 |% Y3 j( K* j
}
- w ^- e! N" N/ X: `else if (document.layers){( E2 ^: c z1 n" p o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# O! M& n$ X0 X/ ?5 A0 k5 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! I' P$ `8 T0 j" f
write('</ilayer>')+ }& T i- B4 L* q$ Y' N
}
& \2 Z- ~- V, @1 `document.write('</td></table>') q7 K b+ Y+ V' c
}
" z \" d' d) s6 U}
9 F3 N6 y+ a$ u- t</script> |
|