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

|
网页之跑马灯文字特效
//修改宽度; ?% V1 {; \' u) r2 }1 i. H
var marqueewidth=3002 t2 F6 t$ K- O! X( g6 Q
//高度6 U- {6 A/ t; Q* h& c, f. P! }
var marqueeheight=25" N) C2 k; ]6 l+ X- T7 y3 L
//速度(1-10)
: M/ c8 {" p* X" [var marqueespeed=3* w# b# z" U* W3 [
//背景颜色
. J% P% u: T$ k5 n) d2 c) nvar marqueebgcolor="#FFFFFF"7 E# f$ T6 q" K5 y' I
//是否能暂停 (0=no. 1=yes)?
1 q, _; e# v7 p! ?1 a( }var pauseit=1
6 M, O$ ~2 o/ U6 g9 \2 o& T6 r X$ M9 D
//修改显示内容
' m: s4 t: T& }: p# y, x+ Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 z/ F9 V! p! K( v
9 h6 M) r" V: ?/ j) \/ Z. e
; D8 S4 w! a" T. ~6 b
////下面不需改变////////////
, U1 f3 }9 b, D) H( q3 q1 X& a E( l# }) A% T, C: O) }
var copyspeed=marqueespeed6 g! J/ C% K8 ~5 E
var pausespeed=(pauseit==0)? copyspeed: 0
/ s3 |: h1 A, ^+ n. {3 pvar iedom=document.all||document.getElementById) _6 H6 d! u2 J _, V
if (iedom)
0 {) I- k. L6 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- B. B% g3 w/ t% v2 h0 Q0 Z* p# @var actualwidth=''# S! u$ L& d* M& T: ~
var cross_marquee, ns_marquee
5 h6 \1 `) I( p& ?
- f4 D9 _) f" zfunction populate(){' Z) ?+ y, F/ x! C
if (iedom){
8 `0 c. X6 Z, [# j+ ]' ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 X" Q. A7 b' V- K1 Y
cross_marquee.style.left=marqueewidth+8
0 Z; |8 g% g: |cross_marquee.innerHTML=marqueecontent+ G/ b: h l! m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- O9 f# N3 L. P, o/ U! ]; C/ ~2 `}& P! G3 Q) y* A% A/ J0 o1 ?# A I& }
else if (document.layers){1 r% c! }! t8 e$ N1 ?% f
ns_marquee=document.ns_marquee.document.ns_marquee2
( {* M9 e- r: D! |6 ]ns_marquee.left=marqueewidth+8
5 I# W; F0 A6 Hns_marquee.document.write(marqueecontent)
9 d9 ~2 }8 o7 p2 cns_marquee.document.close()% {( G) K$ P6 W6 H1 r! u
actualwidth=ns_marquee.document.width
4 r/ u/ X% d' p6 A$ e}
% P/ P I5 m4 w* G/ wlefttime=setInterval("scrollmarquee()",20)
0 s3 S2 q4 ~0 A/ c! o}
" \4 n8 p& P( K/ b9 J- q$ i. N# Cwindow.onload=populate# P4 m0 [6 C/ J. I. Z
0 }+ ?. P7 q% o* ?; g+ Z# r
function scrollmarquee(){* Q1 n t# n1 y1 q! \) y# ]
if (iedom){. ]( d% A2 e/ a1 `' \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: K7 i Z" m1 g \9 c1 f/ m8 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! j5 d# k/ v* c4 h/ Celse7 g4 @8 \( h: _, [6 ] x
cross_marquee.style.left=marqueewidth+8, U7 U, f4 _1 _6 Z8 g
) U# Q5 m( H6 ~
}/ n) a' {; U- T
else if (document.layers){. d+ e9 b+ x6 D5 w+ N5 [) K
if (ns_marquee.left>(actualwidth*(-1)+8))
1 |+ m- m X' b; e% N7 Fns_marquee.left-=copyspeed1 D6 N6 {; l8 F3 x8 t7 X
else
& v/ F O9 b0 P5 t2 p% Y1 Lns_marquee.left=marqueewidth+8
; j4 }- s! B3 n& k$ ?}
) \. N' l& g( j2 z}) P. R/ b+ m% F+ N
" b* ]0 O% x$ M5 _" [if (iedom||document.layers){
& u i$ O) n% J l$ k- d2 \with (document){2 R. i$ S; N! e' b& J& e9 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ F- N$ E1 ^) @% R: Aif (iedom){0 Y: m$ X! M% h1 V2 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# ~: }, [7 m: I0 c# e5 e* w9 G* p X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ b' v7 ]* [7 [' u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' M( |) E4 v, t/ R, O+ E
write('</div>')$ R# B$ f' H/ W8 m" C. f* k/ F
}3 S5 J- W6 f2 I8 \' }' a# ]2 k! D6 c
else if (document.layers){
0 z+ ?% j' M* N6 z: I7 R" Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; ?7 ~2 `. s* ]5 k9 y. s9 R4 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 i' [3 N; H2 P5 ?+ t# ~8 V9 v' H
write('</ilayer>')
$ ~. P6 f) B5 z& A& ]5 F/ W( V}
& c8 p* B+ c; g( ?4 \document.write('</td></table>')
7 M; x+ |* g5 `}
! Y6 k0 P* T& Z) f}
4 ]( Z* P1 o. V</script> |
|