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

|
网页之跑马灯文字特效
//修改宽度4 d3 F+ O/ w! X8 R; g- V
var marqueewidth=300
& }; Q, P: l" C6 a$ g0 I3 _2 {//高度
; W B' l9 D5 B6 s. T1 {$ Bvar marqueeheight=25
' W5 h7 i# }% I4 k/ ^+ ?//速度(1-10); j1 i9 L" H4 m" }, O* q
var marqueespeed=3# n+ ~4 r- e; b( Q& F. b
//背景颜色0 T @, L7 J" o5 a1 X6 j$ p
var marqueebgcolor="#FFFFFF"
3 b) c- U; t* f7 y" E% M//是否能暂停 (0=no. 1=yes)?4 E# |$ I( K; I& L: T: ]! o9 P
var pauseit=1. L: S3 N: b5 B5 m Q
' n- u7 P7 f& Q, e) _
//修改显示内容. T; ?, X' j4 ~- y( f5 _. @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" k3 A( d, w; i4 z8 K1 y1 q. E1 \8 g. b- Y, Z
2 Z% H* [, a/ @/ O8 j////下面不需改变////////////
( ]3 R: S! O4 j# R' b$ M! b, Y8 e, N6 _
var copyspeed=marqueespeed/ T# O- |# J; H- U
var pausespeed=(pauseit==0)? copyspeed: 0+ S( l; k' ] R$ T" G4 H
var iedom=document.all||document.getElementById
7 v6 p" \1 I% P8 `! z/ iif (iedom)6 W, d7 X3 @; C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% `$ Z* H \* j( n2 l! Ivar actualwidth=''
$ z1 ?% ~/ c3 \: }% O4 J: j1 Gvar cross_marquee, ns_marquee! m. M4 h9 j s n; o3 C. c3 ]4 Z
, ~, T/ L8 l; D8 Z; j; G- Gfunction populate(){# O; ~, d6 Q; O d8 W7 E
if (iedom){3 q1 j+ d; a: F8 `4 T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 J; M. I& ?& a t+ m/ lcross_marquee.style.left=marqueewidth+8
* J7 q6 e7 Y' U! Icross_marquee.innerHTML=marqueecontent
* k/ l$ K4 O. }( \. x Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 k1 \1 ~3 K" x5 A}* o% X. X, s, P' K' y; d
else if (document.layers){. V z5 h3 j+ l" ~1 V0 m
ns_marquee=document.ns_marquee.document.ns_marquee2
( a* R5 p+ S6 m/ Ons_marquee.left=marqueewidth+8& {7 W' K* o" d7 `2 U7 O
ns_marquee.document.write(marqueecontent)6 S) _+ ?: G' \' o9 b
ns_marquee.document.close()* o% o. K1 B# L9 B
actualwidth=ns_marquee.document.width
/ S. k! J$ f" H}
/ r/ r8 A& T$ B8 e6 u$ w& Ilefttime=setInterval("scrollmarquee()",20)) y' f& R* Y. d# @
}
9 A" M9 x- g0 r% o4 R$ e$ r7 Ywindow.onload=populate
. o& P1 _8 ]0 w2 P* N& Y- _$ ~# N/ h0 c: b2 I
function scrollmarquee(){
. `9 m- H4 u& h) l4 Dif (iedom){, g2 L9 t& S) O, P# i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) d: Z; N6 ~: T# v7 M$ X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- i3 f/ P5 D, l2 Lelse
% o p! m6 F2 \, h: s1 _9 t; ccross_marquee.style.left=marqueewidth+8' L a) V! I5 N$ u* q
- g9 Y0 C, b" c}5 D+ O, }8 g- G8 ?2 \- n
else if (document.layers){0 G+ ~9 f9 f2 G% m' o) b
if (ns_marquee.left>(actualwidth*(-1)+8)) Z$ Z. u. Q. @9 X
ns_marquee.left-=copyspeed9 X' u3 v7 q& [ U' J, x" Z
else
+ ?7 ~, E0 Q0 Jns_marquee.left=marqueewidth+8
0 ~: R4 |1 B: [}* g0 s3 Z+ O+ x- S1 p/ B |( y" l! C1 T
}# ]" O% y( F1 {* K4 E) {( A2 w
5 c: U0 Q; E4 ^* ^+ D
if (iedom||document.layers){' w2 i! p; a, ~4 `0 u. _3 D
with (document){2 b3 R; [& j @8 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 M% a" b& \/ [" @6 l( y: h8 h
if (iedom){8 m6 v6 {0 F" g: e j) }) Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 _' m$ Z! a, T" l7 E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* S+ Y; u% F f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, C. n4 q1 d! ^- g; y9 \, fwrite('</div>')4 b4 [* U. ^: R7 L j r
}5 p% S, m2 a/ l6 i) M9 E
else if (document.layers){
% l4 L% I9 _$ [4 ? twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( E+ N& }9 `/ G$ b9 S2 m5 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 b& L) l3 Y O8 j) x1 G9 N! z Vwrite('</ilayer>')
. C- [: V8 m5 w. U& D/ h7 P}9 o% s% m! e" L7 y' Q$ X/ e! r
document.write('</td></table>')
6 p6 n- B" T: n}
. v3 O' X2 b, ^; u& K7 ]}: n! u$ ^6 s1 h" L! P6 x3 R5 l/ ?
</script> |
|