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

|
网页之跑马灯文字特效
//修改宽度) J( I6 m2 C3 j: g# N- K- r" f+ F: _
var marqueewidth=3007 W8 I* [, W! f, y3 m& O7 y
//高度
1 _8 O, Z6 f# f+ Q9 K+ Tvar marqueeheight=25
, U4 Q5 S7 p( W& V1 ^# s' F//速度(1-10)) g. l0 j$ n Q
var marqueespeed=38 p$ _9 ~' a. ^: n
//背景颜色
" N+ {, Z8 A$ D7 @) lvar marqueebgcolor="#FFFFFF"1 }+ z1 q! O% z) _$ B2 w0 }
//是否能暂停 (0=no. 1=yes)?4 A- U7 C9 W% L. i4 O. A
var pauseit=1' L, f+ \: e; P* Q0 t2 V
/ d6 d, i" l. O7 Q//修改显示内容
) [4 A( j/ I0 B% o5 |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ Y' `+ E2 H6 ]0 I8 R2 J* ?4 Q- B" h) B Z1 S5 n( g: j
S- n9 i0 p* H. `. c3 K/ e1 v, N////下面不需改变////////////
- Z! m4 q7 Q$ D& M6 m( @# _. D: O: e- y! r" }
var copyspeed=marqueespeed+ H5 |; e2 K/ v. ^* d( f6 x
var pausespeed=(pauseit==0)? copyspeed: 0
+ R! {+ c. ]% m; z) N& f* F% [5 |var iedom=document.all||document.getElementById
% a" m0 c/ Q ?; l/ O# {8 ?( eif (iedom)$ h1 F7 Z L# n9 f' n( c5 S- Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 {0 w# s' o# `var actualwidth=''
2 R5 I# u6 @* S M7 yvar cross_marquee, ns_marquee' G, K ^5 j, A' U# B
2 ~2 }3 E: ?* D4 y8 D: }function populate(){
3 z4 g2 w$ S) Lif (iedom){+ N* m" S* n# g. j6 K4 v* H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 |3 l! O! X/ Q+ l' v
cross_marquee.style.left=marqueewidth+8# A+ r0 {9 P' S2 Y/ B
cross_marquee.innerHTML=marqueecontent
/ J) @& x# l, e9 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
e- }6 u3 R! _- q}
+ V) ^8 f& u( I* m( p, v: U/ {$ {else if (document.layers){2 R6 m6 w+ Y0 H& ^% o; Z
ns_marquee=document.ns_marquee.document.ns_marquee2
- y& n' Z+ f5 [$ E& uns_marquee.left=marqueewidth+8% G: `, y: H; P9 p' v# @' y0 D
ns_marquee.document.write(marqueecontent)( Z9 O, O" G) } @' h+ j! s
ns_marquee.document.close() I; k4 u- T- G! {
actualwidth=ns_marquee.document.width
, z* P2 s3 x3 t# B4 j& g}
; H0 N% `2 o' S- Z" M% Jlefttime=setInterval("scrollmarquee()",20)
% w; ^) {( f0 W f}' P* h' C ^% F S! L
window.onload=populate. h$ _) h6 a5 k/ Y3 R8 s) [
" E" U9 }# e- M3 I9 [
function scrollmarquee(){4 Y) U+ @$ v ]) X- B2 @
if (iedom){
, p& I) e) }: G+ x3 S+ {. Q0 `& lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ Z( H- B& Z8 \8 bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; `$ C: d- f5 w9 W* X8 L
else% R1 F8 B+ u4 Q1 i4 f* {
cross_marquee.style.left=marqueewidth+8
' _0 M7 c$ _ w( ?+ a+ p5 k: ^# |7 ?* w9 Y |
}/ W; ~4 i& ~3 i
else if (document.layers){
6 r5 a" b0 E) b* z0 p1 Wif (ns_marquee.left>(actualwidth*(-1)+8))
3 h2 B; A# L2 j; X2 ~: M4 X B2 p" I, Rns_marquee.left-=copyspeed2 f/ d3 n8 `9 e: c% y$ o2 I$ y8 h; w
else- O- @6 v6 f3 U0 N$ H( @$ N
ns_marquee.left=marqueewidth+8& H4 j6 t4 ~3 z1 L4 O2 z
}) n8 [4 G% O j( v+ ?; m+ m
}
4 Y |8 c- j7 E+ @& R) o D. R: i" E% K/ O5 d, z
if (iedom||document.layers){0 ]7 D; |8 y8 O3 y8 X. }4 s/ t
with (document){
4 q! `% I1 A2 n6 R7 }( ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 p- G% N* L$ i, Mif (iedom){( q8 j: k# y1 x. g4 e) ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. }: x" t* i$ R8 iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), z) k- e) T" [- t5 Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): |7 S! \+ c3 U$ w; C5 N/ z
write('</div>')$ ~- C( g) e3 ^; P7 t
}
* ~, G+ B- x# t2 |3 @4 f1 pelse if (document.layers){+ U, b! t( V7 V' w/ n8 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 H: i; S' o: G& K2 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- J0 p5 D$ a) y7 `2 z x
write('</ilayer>')' a$ Y0 x6 y: h6 v! J& [
}5 L- d2 }. |' m
document.write('</td></table>')
1 X9 M6 \) H* c1 h7 a; y1 n; \}) j' r9 k8 M, `1 p* _
}; E/ ]' b- H( b
</script> |
|