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

|
网页之跑马灯文字特效
//修改宽度/ N: ~- l& H- C! W# o! R
var marqueewidth=300& A' m! z/ I& { t0 Z
//高度
/ ]) z& ]* D6 s: Z* `( g" p: {var marqueeheight=25
% X! a5 f9 |: I' J# u, g' l//速度(1-10)
) U" e: g; Z0 e- g8 Kvar marqueespeed=3- l6 m. k% ?! X2 P( e! o2 V
//背景颜色
{: W; N( X, Y$ Avar marqueebgcolor="#FFFFFF"4 |% C6 s6 {6 r/ ?) h
//是否能暂停 (0=no. 1=yes)?
T/ k% c9 u0 ^0 J* [var pauseit=1
) H9 S; I8 o6 P& X8 T5 D9 Q- h' t n+ H) o- A
//修改显示内容& p t7 z" k6 z9 D' [' m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ u4 q. l1 A! y7 L: i
- K- s! u' J9 N: V n2 }# u5 m+ }& r( C9 g4 x
////下面不需改变////////////
2 z* m( ]: m* Q( n# W: P/ s( y6 L. `) `0 L
var copyspeed=marqueespeed
6 r$ _" }' H9 O* U q" kvar pausespeed=(pauseit==0)? copyspeed: 0
' h, L1 ]7 A( J' u, Y+ Q$ f; Pvar iedom=document.all||document.getElementById1 B# y# o+ G0 g0 O7 }+ n
if (iedom)" H4 l( u: i4 I2 g& @% F F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Z% q0 p7 U/ t5 T0 z5 Q+ Svar actualwidth=''
* H3 c1 I; U9 Q8 E+ xvar cross_marquee, ns_marquee! g( t l! n3 l& F& e9 q' R
) Z; y0 Y8 S" W8 x5 f; Rfunction populate(){+ u. C3 g* d0 B- h4 C4 H- R
if (iedom){" ?: | m8 |2 g/ u+ K: \! L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: t, R9 j" q0 `9 d/ Q' ocross_marquee.style.left=marqueewidth+8
7 o7 r* ~8 `9 V! x4 tcross_marquee.innerHTML=marqueecontent
& Z" q% ^2 B2 l7 h' Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& z8 o" Z( l5 t$ d& N
}
8 y6 q5 S3 C$ e; w* X3 I# u _else if (document.layers){3 W. C0 C5 J* K, y
ns_marquee=document.ns_marquee.document.ns_marquee2: ^0 D3 I- N: x) ~* o9 }8 r
ns_marquee.left=marqueewidth+8
. S& k: M) G( r% W Z4 h( t2 xns_marquee.document.write(marqueecontent)
5 F5 O0 I/ E- `% Pns_marquee.document.close()0 t4 }# W. o4 l! E) \$ r2 q9 V
actualwidth=ns_marquee.document.width
" W! B! s% P& C Z$ E}
& [/ K: K" {7 p- I( a& ]4 b5 }lefttime=setInterval("scrollmarquee()",20)
# p u* w# R+ N8 t2 t}
3 z$ f5 i6 o8 N, J/ f) Ewindow.onload=populate
. q; t T+ m' L+ g% |+ j6 m8 B' e+ A6 s, a( D3 ?) Y/ S3 ] ?
function scrollmarquee(){) s; X8 H+ t- b6 g. k7 B
if (iedom){8 f# Z) O) @5 ?+ {$ V3 ?) |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) y* B9 Z2 k% x Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 i: j0 d: m5 M- {: M: E' T. j
else% [& e# L; U4 m1 i6 J/ s3 s
cross_marquee.style.left=marqueewidth+85 ~. i/ { t0 ^& A3 Q& K5 t6 z
; v8 m: |6 h0 L p. K% b( i- k
}) K5 k% \. B' ]4 P d
else if (document.layers){) H: t; f5 T0 a6 @5 K1 D8 D( Z
if (ns_marquee.left>(actualwidth*(-1)+8))
" X! A, X7 l! A) l3 f3 wns_marquee.left-=copyspeed6 c Y1 S& X1 x1 f) I1 E1 {
else
, v d4 k" P: j \ns_marquee.left=marqueewidth+8; U* L, F2 ~ h: z! [5 y9 j
}
1 M; F! x+ a4 M3 V) D4 P: q" X}
: ?3 o1 S0 d0 X# o2 z& M' d6 r0 z( g
if (iedom||document.layers){
+ X# @; u5 L2 `with (document){
, i& P5 r3 s2 ^7 Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( e S9 w$ J' J( ~if (iedom){
. J0 N; W9 n3 ]7 `' Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# |% E% h& E, |. h- `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' N d9 B; B. q5 k" | v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 E; {. N; S2 B. ?- H! l: B
write('</div>')! U& I5 w e' k( S$ k' `
}/ K3 ~0 _. c e" ^3 e7 d/ ?
else if (document.layers){
* i" ?+ F& P1 c9 E O8 wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) P0 _! @. {3 ~8 w+ U! \1 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
l( W N/ O/ _ \: c+ Q4 N2 Kwrite('</ilayer>')1 ~, L) n5 Q, B1 l. x0 [/ S
}) n7 i+ P$ a# E' k
document.write('</td></table>')- G: S) _; K) R& L- _( ?- O$ J
}
8 ^. v& F0 P9 n7 K+ u) t}
3 [2 T& f5 l# f# t: B</script> |
|