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

|
网页之跑马灯文字特效
//修改宽度
/ Y0 |& Q6 X7 a7 h) J/ U& vvar marqueewidth=300
$ f+ L. D* l! f) I8 m1 M) g//高度
8 ?" ^# M7 w2 y' c# W: L0 b% Ivar marqueeheight=25
! u* N, Q7 O& ~- R//速度(1-10)7 x G, v3 a! w7 p0 G7 h; p4 x
var marqueespeed=3% a- r. \$ j( }$ g0 f: f9 [1 V
//背景颜色
. k. o8 k1 q( j2 vvar marqueebgcolor="#FFFFFF"
/ y% ]3 h" Q* p7 i4 | V( d//是否能暂停 (0=no. 1=yes)?
3 }8 Z; [" o; N% M1 Uvar pauseit=1$ ?6 J$ M$ U+ G; _# R
% w* _+ W; Y3 T3 ~) ~- ?0 ]+ ~1 T
//修改显示内容) {) H# {, u3 [3 H) I* c+ a& `5 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: C% N6 _# ^, K `4 n4 ]
* Z' V; N0 l' g5 }3 W" `' [0 c3 ~. {; B& d0 C
////下面不需改变////////////
; A* }! t9 k7 q3 r f9 |+ p4 k# l# l7 |9 h, \& b
var copyspeed=marqueespeed/ E: N% Q8 ^ \# l
var pausespeed=(pauseit==0)? copyspeed: 0' Y( F% I- g# U+ _; j
var iedom=document.all||document.getElementById9 ~# Y# h. R6 p* W8 m3 v
if (iedom)
7 G# d1 A8 H2 P" Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 V7 h* `+ k( O0 q+ c9 Y. M% Avar actualwidth='' m: _' P) R! R
var cross_marquee, ns_marquee
- @, R, a% a' h7 x" s" t- D8 K* f+ n5 j" n: W4 a5 z' ^
function populate(){
! G& {$ D; j) K% }4 ]; e9 uif (iedom){
7 a/ o# C8 Y" d P, u9 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 s+ l% X0 d2 j# ]cross_marquee.style.left=marqueewidth+8
* L7 G* L: S- D& ~+ m2 Y- Wcross_marquee.innerHTML=marqueecontent* y3 L$ v; }9 e6 b) v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 b& C# K5 X- _4 K0 T& Z' C
}
* O# _* h5 s1 b& u# V4 pelse if (document.layers){
- H# Z# L8 o( v# z, ons_marquee=document.ns_marquee.document.ns_marquee2. m7 C |+ N* |4 @# K
ns_marquee.left=marqueewidth+8
5 J4 v; |& d) A0 O% m% K) q2 pns_marquee.document.write(marqueecontent)
# _/ i9 l( c2 C( D! l Sns_marquee.document.close()9 d5 k G5 L, r' C
actualwidth=ns_marquee.document.width6 h& D. B6 V6 Y9 h. m# X. Z
}
8 _$ W3 U6 H2 p4 e3 K- S' }lefttime=setInterval("scrollmarquee()",20)6 n1 E# Z( {( I0 n
}
9 ?! }/ Y- y# }$ M5 ~ w1 ?# ^ ?window.onload=populate
/ L5 ~ j I3 \1 e1 f8 ^0 U8 I
% S G+ n9 r: L) w) y2 E# f8 Z6 @function scrollmarquee(){
; I3 q" C8 y# g. U( N. H- a! sif (iedom){2 E% B) T. }. K/ E3 t2 Y: }0 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) ~: q/ d9 j. W6 E4 w' }5 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% T0 ~! U ^, Z# u) h! C$ e9 I: helse
+ v3 `+ F: h3 s9 n# q) Xcross_marquee.style.left=marqueewidth+84 O$ n( J' b: N9 h6 l
% g2 q2 j7 u: K0 C
}5 t( C: E9 B/ \6 C
else if (document.layers){% h: f& W/ L4 B2 U) g' T, M
if (ns_marquee.left>(actualwidth*(-1)+8))' p. }9 _! R5 g" F3 P( h
ns_marquee.left-=copyspeed
' W+ k5 ~: a1 O+ U" M/ zelse
& h }% I- z# xns_marquee.left=marqueewidth+8/ f2 s7 D" M& c* T
}
$ g0 `& P5 | L3 t* [, }}( r1 ]8 b& D- t5 y+ N
' b2 `; ^/ v, s- k* x
if (iedom||document.layers){8 j' {) c2 Q- h, X! {7 W. Z$ y% C
with (document){
1 e& F0 k5 d* M3 U5 Q( U& y' odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- \3 \! D( H9 R1 \4 G1 y% B+ V. ~! A
if (iedom){' e% W5 u! b# u' @5 p/ ~/ X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 Z: P+ K" k# \! Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: I7 b! K. N* Y+ }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! i. ]& ]; B2 D$ ~, ~write('</div>')
) Q: I; B. \3 m/ Q5 D}
) V0 Y- j- L0 R7 W/ Ielse if (document.layers){
# Z$ H$ d$ h7 Q+ e* X) ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
i/ y$ O/ f9 ~0 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: u5 S) o5 u/ F+ l5 f5 y& Bwrite('</ilayer>')
; a# h0 S2 G" F2 K! U}; |5 {+ g1 ^- s* Y" f- ~" e/ Y
document.write('</td></table>')
# K1 [0 C* ?% o* o+ k6 w}. \; L, R1 g, j- ?; t% H0 v$ P
}7 D3 W( s5 A# D
</script> |
|