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

|
网页之跑马灯文字特效
//修改宽度; I3 J/ u7 p& a" M$ Y/ ~9 F3 U# k
var marqueewidth=300
: J. o) N& p8 Y, D( Y$ i//高度( U) J" C) ~% O: g* B" w
var marqueeheight=252 L& p2 C- J/ |6 t. C( v1 K
//速度(1-10)
" N, X k+ y6 s2 M% svar marqueespeed=3
3 G8 `3 u: O/ h8 V q* v//背景颜色
" A% m* l; g2 V/ B4 ~5 yvar marqueebgcolor="#FFFFFF". J) H7 |! }! Q. h1 E9 t/ ]
//是否能暂停 (0=no. 1=yes)?4 Y% Z6 M$ m! v7 p. \. r( [% ~7 B
var pauseit=1! y+ H* W) `* I0 u8 y1 T6 ]
1 @4 I& V! \* k v
//修改显示内容( V9 C5 B0 ]5 k5 f! u" `6 F( p& f" g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ B6 G f; l% m- q; F! G2 @
" R \# j2 x7 u' c
5 g3 ?4 Y3 o& V" W; _3 O7 Z, `////下面不需改变////////////- y" G6 u+ H" [9 g# }2 v
( K1 @' Q9 g: U/ W6 Bvar copyspeed=marqueespeed
% m C6 M% ~* T6 |5 n8 C+ `var pausespeed=(pauseit==0)? copyspeed: 04 y) o1 Z* W* y2 ?. X6 Y6 u
var iedom=document.all||document.getElementById- C- l1 a s- `" b. S" Q. }
if (iedom)
6 P2 }1 k+ L0 M$ _3 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). ~1 T6 _7 ~. q9 s0 I& e! K7 w
var actualwidth=''
5 q* v. A( K0 K5 i& @# wvar cross_marquee, ns_marquee/ Q# p6 _- F* L4 x% u
3 B2 w+ c6 u0 v4 a+ o1 `( ~function populate(){! |0 X6 U6 o; b& k6 Q3 O
if (iedom){
; m2 D0 [, ^5 Q+ c1 A; p* O8 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 Q/ E, e' I/ T
cross_marquee.style.left=marqueewidth+8
4 n4 G! O$ i9 M! o" Ocross_marquee.innerHTML=marqueecontent
5 X3 P( c' n- f& Y8 [" T O, |7 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; i4 T$ n) a2 N- U! n
}
( Z' ]( x- h. O P* u. K4 ~& _else if (document.layers){+ t, N7 P' e0 Z4 a1 ^; M
ns_marquee=document.ns_marquee.document.ns_marquee2
2 e( Q- J8 |5 lns_marquee.left=marqueewidth+81 X4 `/ w: q/ U0 p2 E6 v
ns_marquee.document.write(marqueecontent)
& F+ c8 Q, [; i Jns_marquee.document.close(), R3 o8 W: m# _; T& G q+ f
actualwidth=ns_marquee.document.width
; Y* I# Q# Y0 y X4 h4 @}/ [, [! Y! D# t, O) x/ s
lefttime=setInterval("scrollmarquee()",20)6 U8 U* \/ x# J- L& {8 D$ {, T
}; G; r V, p$ _
window.onload=populate
" x `) \ _; @: a# z# B
5 z. m0 b* n! H# L* \function scrollmarquee(){
$ t: [5 f' Q B& Eif (iedom){
* B* A9 E2 e: fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): l# x. ~4 p# K. B' U! b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* h$ a5 O) b( o/ _5 U& [0 Q
else
( V' V3 m9 ]4 I. s! n, g z' q6 wcross_marquee.style.left=marqueewidth+8; J% g6 W6 q' f# b/ Q
* Q$ z8 m2 r8 H& E/ X}
i) `9 G6 T' C7 X, Selse if (document.layers){7 E' f2 ~3 F* o I3 s! w
if (ns_marquee.left>(actualwidth*(-1)+8))
7 R4 A2 o- g4 r! P! E. M* p* vns_marquee.left-=copyspeed/ Z" S- f' m& ~- h% @2 y
else- M/ }# U- i7 j/ s# E
ns_marquee.left=marqueewidth+89 ^" _- ^4 m- C+ @% j
}
1 E. j) U( Y, y( U# I) ^, s& B% Q}
* J. I* h" b1 R+ X3 c! M
& D. J1 q$ c1 \3 V- \; Bif (iedom||document.layers){
+ b) l8 G) {- W/ F" }6 g% Bwith (document){7 k, b# V% t9 R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 R/ \/ Q# ?, A% c8 X7 `if (iedom){
9 c9 Y) k3 M, n9 h0 p9 `- owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 I' N" G4 a% [% L; Y4 y7 o. m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# b4 M9 q0 Z3 d2 i2 B0 }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 R; H3 o3 m o+ ]write('</div>')
! ^% f5 c/ Y3 i2 e# b}$ }% Z* T" k" j, |8 H& F/ A. I# c
else if (document.layers){
0 ?' m; R6 b- E' ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 \% |: D T# P. G. uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 v) n5 I/ i) J) g) Y* J" Ewrite('</ilayer>')
2 [9 T M4 E3 t, ^3 }+ X}+ @+ W* P" }9 _0 C) E, p% t
document.write('</td></table>')& W/ N, r1 _6 a" P1 r; y2 M
}' R. R- Z2 U( q
}
' B5 T$ M9 X4 L</script> |
|