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

|
网页之跑马灯文字特效
//修改宽度
6 [/ j6 q' E' m: uvar marqueewidth=300
* K) F3 L7 j5 S( y4 _- B//高度* M: R7 e, [- v5 @; b
var marqueeheight=25
! o t/ R3 D* B9 v//速度(1-10)' v0 g3 _: V4 t0 X; ` T9 m n
var marqueespeed=3, V$ n) h0 K% r! d! q
//背景颜色5 l1 v1 \% X4 L1 a: n
var marqueebgcolor="#FFFFFF"
6 [; f$ U3 b; m U//是否能暂停 (0=no. 1=yes)?2 x0 [! R6 E6 K+ z
var pauseit=1 f5 N( I0 I4 a( C
) k j+ Y8 F3 ?- q3 \: f% O: Z; P//修改显示内容
3 [ N1 L0 ?! D ?1 B$ _- T$ rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 ~* D ]4 H, t9 f+ j, f. H% V& [8 G. @
5 ?: T2 X& t/ r% v////下面不需改变////////////' v" V- x1 D4 c; X; H
& K( w# @3 h8 q
var copyspeed=marqueespeed
5 ~ g: v2 s/ A; E6 @/ \var pausespeed=(pauseit==0)? copyspeed: 0# C/ {- B, \6 e- m5 o
var iedom=document.all||document.getElementById0 |) O( M3 I7 x5 ~3 L) ]0 z
if (iedom)
% x+ ^ H$ T8 _% J0 b: X! J5 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 p% V x9 W/ y- i9 qvar actualwidth=''# V. `& [7 o! S6 l, w7 V& z
var cross_marquee, ns_marquee
6 p* g% a2 j4 i: A& n+ F: A$ b+ c6 x1 \) v& r
function populate(){
2 Y7 L% L4 ^) Y' `% \- T5 K Z' Xif (iedom){, K7 Z; V5 |- D! `3 l; C1 s+ p& J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 ?' u( n! h7 N; h+ Y! j6 kcross_marquee.style.left=marqueewidth+8
3 f; c V$ }5 `* \# o0 rcross_marquee.innerHTML=marqueecontent
8 ~8 i6 f' _1 j, Q. S/ ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 n: U6 I9 h2 a1 x, i2 `! |}
" ^$ E$ J$ r8 d. g& u, lelse if (document.layers){) M! m& F. Y4 G! i A$ F$ z
ns_marquee=document.ns_marquee.document.ns_marquee2
8 O0 C; t" `4 f4 Sns_marquee.left=marqueewidth+8& v6 f2 i( R; n( [1 w, \% j' G# q
ns_marquee.document.write(marqueecontent)
7 F0 {8 B5 _/ X( C0 P7 }& q6 @0 L2 S! `ns_marquee.document.close()
% j. S7 V) Z: y- d$ r3 cactualwidth=ns_marquee.document.width
% S) i2 y; ~. U}
& ~4 ^" N: L7 D0 H3 j2 y3 ?lefttime=setInterval("scrollmarquee()",20)
$ P( }0 \6 V0 X1 K! J- O}. ~6 a; H. E) j, J0 C' C3 K2 ?- l
window.onload=populate- D4 z* K$ P/ X2 ]
3 A7 A g0 u7 x0 q+ u& _function scrollmarquee(){
; c2 `; M9 ~9 K2 Y+ N' Oif (iedom){
' l( v, X) ?, tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
H2 x- d$ E: V7 B0 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" f7 D) U! ~+ p! R9 a
else# |; }' ?' x! [% {: u# n
cross_marquee.style.left=marqueewidth+8
/ J: s. U" H( M9 p; h# X& ~8 H7 _) z1 c# H/ C
}# r/ w% B% w6 G) A7 e7 `$ L$ n
else if (document.layers){
2 U- a1 L+ j4 d6 xif (ns_marquee.left>(actualwidth*(-1)+8)) ^" o9 C ]- h1 ~' x2 M/ @4 d
ns_marquee.left-=copyspeed
" R' F- _4 t, xelse
, |# |, d2 v+ e. a. nns_marquee.left=marqueewidth+8: T! U% [( h: {( Y6 J
}
; V8 [* o+ R) f3 W& x+ B7 c' m}
4 u, v, L; L2 O( v; |" e
. W. |9 \0 _! v2 X* L4 V* u$ \if (iedom||document.layers){- q9 P; v6 B' C& T6 E3 z! U
with (document){# Z. @! m# y0 y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ m; e+ j9 \0 w# T2 Y
if (iedom){/ W' ~; K' F$ g! D: d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ p4 X& N3 a# m6 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 Y) I) ~: w0 [: h7 m b; Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
?5 N9 \5 \3 E8 ?: z4 z4 |: twrite('</div>')
- i; X" X' ]- {2 E}+ N- j+ H+ i* ?$ l5 W
else if (document.layers){
7 F# g8 ^+ z& h+ r5 [/ fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ P% r5 s" ^- I3 D6 `! E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' l! u/ J6 A. Z
write('</ilayer>'), y, R, p. I% A3 M# P0 y
} Q3 ~: Q" o ^) S3 P3 P1 A
document.write('</td></table>'), G. C2 A) H8 z5 g
}
" L4 `9 W! N; \4 B" E( \2 ~. g}
) ?3 x3 `8 _6 `$ ]5 k2 R; c</script> |
|