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

|
网页之跑马灯文字特效
//修改宽度
N7 l! {3 t5 @! Rvar marqueewidth=300
+ e# f, Z6 v: H3 \+ a! d w2 y//高度
5 }. R/ a' F( i9 b5 h) Vvar marqueeheight=254 F6 b( V% K2 I1 [5 p! ?
//速度(1-10)* ^8 c9 @0 K: p0 B: r) F1 I$ M& V+ [
var marqueespeed=38 g4 p; @ V' M* v" U6 X
//背景颜色
! o) x! H* D: X: U7 dvar marqueebgcolor="#FFFFFF". t; V; g [- ~; F, W. ]# `
//是否能暂停 (0=no. 1=yes)?
) m3 B9 w; o' _! w4 x: Cvar pauseit=1$ @' J7 x; |7 P. I4 Y
9 k, O: ^3 q- C; C p3 h//修改显示内容, X& l. G8 @' A: a; ^; G) a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" W( k" [- b; Z4 S# h. d9 M% b1 x& L6 Z' ^; j, C5 x
1 o _* T) R6 S' C& r" Z////下面不需改变////////////& d' Y' H; ?+ m9 V
4 c. |# [% Z5 \3 f$ F! Bvar copyspeed=marqueespeed
/ Q$ A' p5 q. ?var pausespeed=(pauseit==0)? copyspeed: 0
. W8 A& S+ p/ N6 a5 f7 {- ivar iedom=document.all||document.getElementById* u1 J8 ` E% t Q1 I3 q, @
if (iedom)
% n2 z" Z1 ]5 h3 |8 a$ m$ ^/ @' O udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ F# g; \7 l0 j
var actualwidth=''4 R# B$ {+ @1 X% X1 D& C
var cross_marquee, ns_marquee
" B% \- D( r, Y. u T6 F+ A! R* ^) P5 k
function populate(){
9 E9 r# M! W5 R7 B. S) _$ c- Cif (iedom){! G. r) W) |( T* C( P" S$ S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& B8 Y0 @' n" J/ f! h6 E
cross_marquee.style.left=marqueewidth+8; S% Q4 d: Z6 M6 m: y1 P. l
cross_marquee.innerHTML=marqueecontent1 M7 a' _# T1 \. w" L7 x$ ~8 E! W$ n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* o( H' I, B" r5 Q2 r. Z}- N! k) q3 Y) y7 A0 Z( n5 @
else if (document.layers){1 }2 r# l4 q1 ]" h9 N
ns_marquee=document.ns_marquee.document.ns_marquee2
5 p3 H, Z# ?" R$ l/ f% [ns_marquee.left=marqueewidth+8* X5 S4 z5 \, O0 `
ns_marquee.document.write(marqueecontent)
5 v! ?/ |* t" a: @ns_marquee.document.close()
5 P, k- O* ~! S% A! Bactualwidth=ns_marquee.document.width0 H. {* R' w, s. e g/ E
}' u: l* l, a! L& D) F# l# I: b$ U
lefttime=setInterval("scrollmarquee()",20)
; [1 \' N! d, C7 H" @}
7 P6 k1 e7 b' s% m2 T1 {: s8 N: Ewindow.onload=populate2 R/ [4 ~3 q5 Z
& r* `) |; C3 M# ~# E
function scrollmarquee(){3 t# g/ g: X% Q' _: s. x/ \+ Q
if (iedom){
. |. U$ o; [3 N9 N) B) w, Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! C; L7 f1 |2 ?* I, a% Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 H+ L X9 ^( B/ k$ `3 ^& u
else# l, ` u/ O3 T6 a
cross_marquee.style.left=marqueewidth+8
+ ? L9 R% }7 t; k# c* e1 g- T0 Y
) O5 S: z& K1 f/ x}
5 p! |4 k7 N1 A* N% Q/ K& ]& velse if (document.layers){
8 G# x4 ?8 {6 c! e8 [$ B9 lif (ns_marquee.left>(actualwidth*(-1)+8))9 p) @" y9 Q+ c t( j9 F6 z
ns_marquee.left-=copyspeed
2 x4 P! D7 J1 ^# h: ]' n- Uelse' @0 o/ K2 w: N8 k e. E
ns_marquee.left=marqueewidth+8
% [- U7 R, Y# f0 M6 h' @}
! \& V, Q( v! e5 {; u( P7 g}
/ }0 p5 i) W* r
0 l$ |* O6 v, l# C: \2 I, t v/ @if (iedom||document.layers){0 ~3 W6 {; U) h7 a: h& H# O1 h
with (document){
8 w% \' _ W% {0 w4 Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: e4 _# u) l8 V |7 Iif (iedom){7 d/ x: m/ w* s' ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ `5 B, L R- e+ \5 U& {+ |0 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 p4 | F% a/ M% C. B8 m: gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ w! _1 @* Y6 ~ Jwrite('</div>')
4 s5 [5 e3 }8 p1 @3 R" s}
% z2 o m7 p/ L8 h+ l. {( [else if (document.layers){
' N( b% S& Z% R& \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- H7 Y$ L B: l8 g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 Q! Y& b3 a- @# m1 `
write('</ilayer>')
' F }% n: u; m}
. ^+ Y$ l, ]# V0 w1 ?$ v3 Tdocument.write('</td></table>')2 x8 K' V# i% q/ W
} r! p0 Q. D6 \+ U
}
' [- V0 B1 ^! P4 ~</script> |
|