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

|
网页之跑马灯文字特效
//修改宽度
" R* o, l! V: W& t0 c' d& lvar marqueewidth=300
' y' e& ]6 `- n. M) P# Z; {1 M//高度 P- h3 u( R1 ~' T' {
var marqueeheight=25& b9 a8 e+ V0 P E) G1 R4 W+ H
//速度(1-10)7 S3 K/ Y8 d- ]8 p' q
var marqueespeed=3- ~' A- W& J; I7 H7 G
//背景颜色) c" ^, O5 F2 ^* F
var marqueebgcolor="#FFFFFF"9 @; H3 V& V! J m+ f5 x
//是否能暂停 (0=no. 1=yes)?7 ?& Z3 q2 t0 T- A
var pauseit=11 K. |% ~8 I* ^4 f) ?( S' p
4 _ U* O6 e5 H9 ~! e' ~0 M7 v! x' x
//修改显示内容
: S* f* b# {0 k' _7 O; Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
\! x9 A7 V9 {( P) \+ ]0 F. U* P+ j/ K- k6 |" I
9 D' c. B" k7 D////下面不需改变////////////
( R1 t% {' g( O2 m9 J1 r9 Y/ Z! a# T8 z4 m! m7 d
var copyspeed=marqueespeed3 @+ A# U, N" p. \
var pausespeed=(pauseit==0)? copyspeed: 0
; T% ^$ M- |% n7 @var iedom=document.all||document.getElementById
^, m7 p! t9 l! qif (iedom)
" p4 |3 x1 f8 Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 g: w! `" S% M
var actualwidth=''
( B+ k6 `2 S) b) Q' U Yvar cross_marquee, ns_marquee
! I6 Y' W" Q4 F2 P4 R4 `3 d+ z6 m; W9 J! I! J2 H
function populate(){. m' Z0 x7 t& ]( j3 J9 H" m+ W
if (iedom){ s! Y. e% Y6 o8 V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 [& B5 L: M _3 `4 `6 j
cross_marquee.style.left=marqueewidth+8
$ i: i/ Y) [# D# h4 fcross_marquee.innerHTML=marqueecontent# { `- \0 t( n) s1 F' m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& ~; Y7 l# w+ R' d1 k M$ m) g' L}
9 k6 U3 A4 {. @% l7 M$ y/ uelse if (document.layers){& L) K* I/ Y9 b3 t4 P$ @9 C) d- d# o |
ns_marquee=document.ns_marquee.document.ns_marquee2
) a0 v) F) b# ]5 b3 U3 ^ns_marquee.left=marqueewidth+8
5 B' \9 ^+ n d3 uns_marquee.document.write(marqueecontent)' s9 M# w- N( R
ns_marquee.document.close()
x3 e, U; I- V' h3 s! z5 T( U1 uactualwidth=ns_marquee.document.width
0 Z" g. t# O$ e; g; k0 C5 E" [}9 x" l: N6 I5 s/ z% x
lefttime=setInterval("scrollmarquee()",20)
% N6 D% a, i# @ ?* s, \7 ~}
. g+ Q/ O& S7 r# {3 ^ D! I7 |/ Wwindow.onload=populate
% R9 D& p. R' q* ^
+ q4 q+ H/ e- W4 wfunction scrollmarquee(){1 e9 p: T( U, E# s
if (iedom){: g3 X ]$ E1 v; h: X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' w: K) K3 I; j$ y% R8 `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& v0 v+ f0 S) R0 ^; X/ x
else- e6 F7 M3 p$ X x% z7 a& L
cross_marquee.style.left=marqueewidth+8
+ ~. f: F" x6 V) z1 S. u3 d! ]8 \' W" A* J) V- c/ ^
}
}* ^3 d' g9 Pelse if (document.layers){
) P# t# x6 I4 n! s! u7 l1 r3 `$ Zif (ns_marquee.left>(actualwidth*(-1)+8))
0 E- l* s# @' @' @9 Qns_marquee.left-=copyspeed! M" g5 d/ g2 q
else6 b$ L' x! Z4 ], {/ x& j. n
ns_marquee.left=marqueewidth+8- v4 y1 B* K* X( \# q9 _
}
& i; U S+ r: x- p6 m}+ g8 `" r( D3 y1 O% d
9 X" D2 i; z- }% Z
if (iedom||document.layers){! G( U1 X* b: Q
with (document){* Z, [) H _' _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# r% S& z! P2 s1 Q) g. |
if (iedom){
6 |# f1 j1 J, p2 a0 E. U0 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 G1 Z/ E) D1 t2 Y) l7 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* S+ R: P d0 e @% V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: O# @% b4 z4 y6 b6 F% f; zwrite('</div>')
3 K1 F3 d; | T; Q* G0 d}. t7 M' o* r0 K! ?+ m# a. w" O
else if (document.layers){4 E) r5 S4 J) B7 v/ W( p2 W. b: r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ R: Q7 z" P* x* s4 d6 kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 n- |" N' D2 i5 D8 {write('</ilayer>')# A. J5 o! Z/ S* p
}- v- p/ D8 ]9 r1 j8 C4 O: C
document.write('</td></table>')% D$ Q. w, k+ T( K% F C
}4 }( U4 Z4 \, K7 ]8 {" _7 F
}
5 ?+ m6 u2 H; f% K- l</script> |
|