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

|
网页之跑马灯文字特效
//修改宽度
% ]8 ^5 o0 h% ` \: a$ m# ?/ }var marqueewidth=300; H& v4 ^( L$ _0 m9 i
//高度
Y2 j8 H" n; }$ U+ j+ z5 Nvar marqueeheight=25* s9 V, G( w7 o. o! c: F0 F
//速度(1-10); k: R& B% g) B ^( J$ P9 h
var marqueespeed=3
) w* ]* J' P7 F$ v1 m//背景颜色
9 x$ W+ u+ y6 h5 x5 _% hvar marqueebgcolor="#FFFFFF"
, H7 u! M/ K% `0 a) J4 \//是否能暂停 (0=no. 1=yes)?
2 u' G! |, ~ n Xvar pauseit=1
2 X y8 g/ u) W8 _& V
; n( ]% C( {% S% }//修改显示内容# F$ i- n: @9 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! Z; m' ]5 O' ]$ \& d' T& [4 E
& X. U* \# U! t8 Z6 y3 q$ O* @2 ~+ }. P. w. D
////下面不需改变////////////
3 m D% M$ ^0 o
3 `& x% I, c* D7 zvar copyspeed=marqueespeed) _+ }" G5 D" h1 M
var pausespeed=(pauseit==0)? copyspeed: 03 L3 ^- Z# T6 r! B
var iedom=document.all||document.getElementById& ?1 \) K- g) _5 }& l% j
if (iedom)
, e7 X5 a) R: Q- `1 [: r; \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ X! Y" `* U3 [ A; Ivar actualwidth=''
# G2 f( I) v6 s3 _! K/ |" A/ P5 @var cross_marquee, ns_marquee0 \ }2 g: S, e6 L V
5 d0 x9 [3 F0 D6 |1 p( rfunction populate(){
; `5 h5 @/ f$ V) I) l8 Aif (iedom){
$ n! Z# u) B2 ~1 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: n' r" K D% z7 W8 {
cross_marquee.style.left=marqueewidth+8
; ?3 {# C) I d. ~% hcross_marquee.innerHTML=marqueecontent
. Y! X- F8 J% u$ |# factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
R: J( d2 ^3 L- H3 C}
7 f. \3 b, g# ~$ ?6 ?, Celse if (document.layers){
- X0 P( m9 t% E* v! nns_marquee=document.ns_marquee.document.ns_marquee2
+ |; P" r% z) i& G3 vns_marquee.left=marqueewidth+8
7 S+ i. \; `% p6 D; fns_marquee.document.write(marqueecontent)* z% E- w4 _4 X8 r: H* I( f
ns_marquee.document.close(). w- f" h5 }+ h. Q7 }- U1 P% j
actualwidth=ns_marquee.document.width6 `' _% e7 s% _# {2 ?% N t
}: T1 f+ M* i" p4 F% o$ R
lefttime=setInterval("scrollmarquee()",20)
( x5 w/ i& g* F, H}
3 I) n! j: `5 R/ bwindow.onload=populate
" F, w( v4 {! M% d* y3 N3 w9 @
7 [! {4 f; Q& A4 pfunction scrollmarquee(){
' ?7 f3 \4 a2 i# C1 x q0 tif (iedom){
* c% H6 |3 ~! r+ w2 Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# X9 y/ g3 P) C4 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) ?4 y5 Z. C; o: m1 C
else8 h5 F4 }& u% N
cross_marquee.style.left=marqueewidth+8
- w/ g$ e% o% @ F' Q2 }6 q" R
}" b' s4 n+ A" h' ]% J
else if (document.layers){1 z% w8 |7 @" ^5 s& ?6 V/ ]3 K
if (ns_marquee.left>(actualwidth*(-1)+8))- l2 D6 N+ t* B' `* ^
ns_marquee.left-=copyspeed
$ O7 i8 Q H3 Y9 j; ~else, O& A9 H5 d) ~; W! n( T/ }
ns_marquee.left=marqueewidth+8/ V9 W' x) u/ y: p q5 @
}- x' L! j! g9 i9 O/ \- i9 k
}
* [$ i: e7 e, i
* t/ j1 e8 ~" ]. jif (iedom||document.layers){
" {; E( Q1 F* h' s1 e& ~7 Awith (document){
8 x& j1 I" R" I8 kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- N4 C) u6 C% S4 P. k) v) I6 P& E
if (iedom){
2 v% j9 y2 d/ x6 D& n. Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 y9 x3 x2 C( G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ {: ~- g) j: a/ x b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 A; c% T- D, j! g1 z+ i5 Lwrite('</div>')3 `6 d3 _% R C* \% d7 L
}; A4 K" Y2 L4 O# _
else if (document.layers){- }' s& T0 |. C# x8 T1 a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! S! B) c% o4 B7 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 _5 \; e ` @8 X: t. E7 o1 @
write('</ilayer>')7 @2 t! z r) O
}' l) |6 j4 ? X" `4 Y( B/ k J
document.write('</td></table>')
W) D; m. K7 Y}
7 \1 J0 }! \& Q- m}* m! d9 R- o! ^' [
</script> |
|