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

|
网页之跑马灯文字特效
//修改宽度
3 _6 Q( [. `, j& Z. `8 ]. X) _var marqueewidth=300
* i( K; }9 e/ S0 u//高度
2 O/ X$ z3 H* e5 uvar marqueeheight=25
9 } P4 J1 G& _% ?' p! w5 z/ S; Y//速度(1-10)
# Z. W# r q9 v: C5 evar marqueespeed=3
" }. \6 Z& `* |: I' }//背景颜色
8 P* Y- f! V" Z @( Jvar marqueebgcolor="#FFFFFF"; q' s, B& s" w3 u% \
//是否能暂停 (0=no. 1=yes)?) Q: c9 n+ |; z
var pauseit=1
4 U4 b/ g% h" H! P8 I4 Z9 l8 q6 [1 C! A; n
//修改显示内容9 m. H/ w2 M& ~. W) B: [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. [) S# b1 W0 q9 k( E
+ c5 w3 t' S5 S3 T
! b3 N V1 |5 Q; p1 u% i////下面不需改变////////////
( @& n, G' P8 K( b/ `& I3 g% a, Y4 n: Z# l0 Z4 I
var copyspeed=marqueespeed
7 v0 g: i c6 o0 C. Tvar pausespeed=(pauseit==0)? copyspeed: 0
( x* v- N/ d, E" U; o- c" B8 pvar iedom=document.all||document.getElementById# Y, K' y& g+ S8 ]4 _
if (iedom)7 U8 J& i# O/ y% t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); J/ O" R* ~8 V
var actualwidth=''$ S6 Y! u6 e1 x9 x
var cross_marquee, ns_marquee9 }$ v- j$ a$ e* f" e
9 c( a% @" ]' o1 s; e
function populate(){
0 O. B4 N5 M5 ]& S: d1 kif (iedom){
4 P/ X- ~% W; {$ o( H2 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. i( _% r: K" j" N, r- x k
cross_marquee.style.left=marqueewidth+8# M. I- h9 b! C- x, Q6 U9 f
cross_marquee.innerHTML=marqueecontent3 ]9 M5 Z0 M& y! Q' g8 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: m, {$ Q8 j# k% J8 I}' `! a; i( F/ [4 k
else if (document.layers){3 j: M }+ J( N5 s
ns_marquee=document.ns_marquee.document.ns_marquee2
, s8 [8 u: r& i" H+ x' I4 \ns_marquee.left=marqueewidth+8
3 u& m8 r; a: a' W; sns_marquee.document.write(marqueecontent)
4 V/ R0 P2 \6 P$ C/ I0 ~ns_marquee.document.close()
& ~* S8 u1 E4 `3 yactualwidth=ns_marquee.document.width
D! T, d5 A9 E$ @6 s}
. y7 B- y( k+ j+ tlefttime=setInterval("scrollmarquee()",20)
8 K; Y1 Y# ?. F3 G0 x! H}
- r/ D: C4 N- B5 R. p' s" Pwindow.onload=populate
% o: h- y0 g; m' r& `, v- O
4 m/ Z+ l9 p4 @function scrollmarquee(){/ D" T$ E9 W- H* c2 T' W( g
if (iedom){
2 ^7 U2 O. {; [9 d& k2 h. o+ K+ |) rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# l8 Y0 \3 H" Q X: f! F+ qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& S/ V) F8 C( L6 c6 w. lelse
0 ?3 l8 A* F; t6 x- i3 |cross_marquee.style.left=marqueewidth+83 B4 k9 j2 ~7 L# J- V; }$ i
b$ \" }4 u8 x1 J}
K$ [! n: s7 t9 e' pelse if (document.layers){ A4 X5 |" S% p! s6 ^
if (ns_marquee.left>(actualwidth*(-1)+8))$ X r% H) F# u5 b) O: b+ R6 l
ns_marquee.left-=copyspeed
. f; M8 F6 w, o/ @, ^9 _else
9 ~! ^& ?& I# C3 v- N, ?6 O/ ?ns_marquee.left=marqueewidth+8
7 A+ T1 h3 t0 v$ U& ^8 g* a8 ?}
# I9 I) J. a7 n9 q}0 `( T( l- P1 q3 a" b
1 ~1 j% P7 G+ h A4 l: Y, `& {
if (iedom||document.layers){
3 v+ {: O5 g# V) X1 Y* N3 J7 Ywith (document){
5 a. z/ V8 K6 }8 v# L, [( M* N! idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( D; X) v7 L/ D zif (iedom){# N8 x2 S3 I2 `- B! g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, } z6 d! S: v- N5 a3 i' ~) \6 Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* ?4 i5 B* r, s( m) D. e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 C: B" i, E" Lwrite('</div>')
0 |) |) {/ k3 e/ H+ m}
9 H$ A2 g. r5 H5 [/ A- jelse if (document.layers){ [: h" {* d0 M" k; T1 @1 g) g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 W; ?0 v* g% k. I) Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ u! [, |0 m4 j2 r9 \
write('</ilayer>')( g" M. a- b! i6 Q/ b1 l: R1 e
}) ]- Q+ G- K ]
document.write('</td></table>')
6 Q6 Y* ?6 v3 k) F}
3 J6 `6 X: ?' ^}
5 ]4 z$ C( T* D) w% a+ b" V4 g</script> |
|