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

|
网页之跑马灯文字特效
//修改宽度
( {2 S0 ~9 f% B/ b' X, g6 `var marqueewidth=300
4 x* I* q$ r' F3 f* ]+ T//高度* A# {! [3 X% `' Z7 g' ~2 S
var marqueeheight=25) \: F) j+ E1 ^9 W/ e" D* U
//速度(1-10)3 C; Z* v% X( [5 n3 H
var marqueespeed=3
, c2 W' b" ?/ H o//背景颜色
% j5 o6 c/ D0 V' Q/ k/ k, Hvar marqueebgcolor="#FFFFFF"2 }) _- x! i& z: d- O1 {6 D- _. Q& K
//是否能暂停 (0=no. 1=yes)?1 W, K- W1 V2 @: Q
var pauseit=1
: _& O. }9 {, p$ c
C" H5 z- H# J; y% s( Y& h//修改显示内容
! Q. S: a% X! K8 a$ I. H. Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ x7 O! ]% }. k7 D9 q6 P
* `% P) ], _2 [- P
3 j* i& o5 T9 \! U+ ]9 ?! j. {////下面不需改变////////////5 p$ U Y _% E* X& F
. Q A6 F& v# ], Dvar copyspeed=marqueespeed# D j# D3 h- z5 n8 Y9 k5 A1 M- a
var pausespeed=(pauseit==0)? copyspeed: 0
" Y. w+ z G e+ x2 jvar iedom=document.all||document.getElementById
v9 g3 p9 ^- ?2 r) H8 f* tif (iedom)( F) K; u5 m) K: e" r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' V! q$ x/ _% X; |) v' m+ }! N) Y
var actualwidth=''$ t( m# z p3 I0 [+ Q
var cross_marquee, ns_marquee, `- c% ] {. e# k+ i
- w9 U* A$ s v! O" Z& J
function populate(){5 m- p/ j( q% p V( a5 ~
if (iedom){
( u2 [- ^ Z3 [/ Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# k2 E% @3 r( R2 a2 j" f8 }
cross_marquee.style.left=marqueewidth+8/ h6 r9 h9 I# i2 b
cross_marquee.innerHTML=marqueecontent
; \! Y/ l1 a1 E; c0 vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ i! C" k) ?" w5 ^}
- B8 m, ]/ b3 melse if (document.layers){
8 ^3 }6 O7 n' U6 D4 H$ `ns_marquee=document.ns_marquee.document.ns_marquee2
0 r* k# o! r( ~* P1 dns_marquee.left=marqueewidth+81 ?$ V7 D9 N) A+ z& C
ns_marquee.document.write(marqueecontent)- |+ \' b1 t; q$ D7 C" U+ {
ns_marquee.document.close()9 @0 [- m9 Z9 Z
actualwidth=ns_marquee.document.width: A$ m& x4 @% s0 P# d
}: u1 i. b# r2 T" `& q3 l5 u3 Y7 q
lefttime=setInterval("scrollmarquee()",20)
( l/ m: [( |; B; F! i) t" {* b' }! t}
+ H6 \! f# Q1 `+ m# N1 `window.onload=populate
( }4 N& o& e* J" m/ I& s# R2 ?' f0 B/ D# g! ~
function scrollmarquee(){# v, P. E1 F7 @8 _: Y# d' `
if (iedom){
6 |1 _5 `: D) V3 @6 Q# tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) Q+ ^( r8 Y- _# l/ x' ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( R: u' U9 a. ? t+ p
else
* \2 U4 q% d* E1 L6 Scross_marquee.style.left=marqueewidth+8' d5 O1 G5 w( N0 J5 Z
3 D S9 M! {1 r j! N( o}, A, S) W0 ^) X/ t; X( }
else if (document.layers){1 Z9 g+ u. e1 H4 j% n0 a
if (ns_marquee.left>(actualwidth*(-1)+8))0 }& c# g$ z) n U$ S$ A+ z+ V
ns_marquee.left-=copyspeed7 f1 F9 l7 Z/ y4 ^/ k: _
else% g6 ~0 d: R3 u2 s1 x1 Q
ns_marquee.left=marqueewidth+8
* [- T1 M% r7 L7 x% W/ z& m" o9 V}/ j4 e' V! Z; l1 a. H5 U
}
$ S" v8 p" V' P
8 Q9 g6 {; s. k+ G0 Mif (iedom||document.layers){
$ T: L' H, I2 |1 f6 ~! K( }9 W& \with (document){
) D, @- R# K" }3 |% \4 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ k9 G, {; t. ~) P% H6 y% Fif (iedom){1 Y9 u# C% j# f- I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
d! r7 L/ `1 X+ [/ Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 r2 Z: U) p& N1 swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; G3 B. ` g4 {write('</div>')7 r. O6 G, ?! ?' R& A' W7 p
}
" h, r% M& @2 f) h+ K Pelse if (document.layers){" i9 d3 {/ C% B m; S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: s5 S0 L x; h. fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; {$ J. i! q" `write('</ilayer>')
$ G1 m# }% S; S) \- u}" q: d) d3 c2 r! z; ]+ I
document.write('</td></table>')
& |7 F; y6 w! P, Q4 z) V6 R2 D}
1 i4 K" V6 b2 B}$ ]# N4 t! u% Y$ L; n' b( `
</script> |
|