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

|
网页之跑马灯文字特效
//修改宽度
0 Q0 t. k( z g$ evar marqueewidth=300
( d. A1 K w9 |3 s; f. K! d: M//高度
) E- `" `0 Z# ], N5 B: rvar marqueeheight=25
% o' C! }9 y: T* o. i. l) ]//速度(1-10)
2 @# {4 @! H; h, B# _, q" vvar marqueespeed=3
1 P6 G' r0 k6 T* m2 B' t//背景颜色
: K+ p* \+ S7 b d) f9 I0 s% ]var marqueebgcolor="#FFFFFF"
7 X, ^! p+ d2 X# r/ l//是否能暂停 (0=no. 1=yes)?! l5 i7 Z$ p: M
var pauseit=1* ^+ Y2 Y7 `$ U/ b1 C
9 y8 J& }+ S$ ?: V//修改显示内容
% N& O" _) T& Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 o& D* y( x F$ I, ?: G0 ?
9 _4 A2 z! T% i# y3 |2 i4 m+ W3 a
////下面不需改变///////////// ^" p: j L7 X9 c* Y1 N, t. r
) F2 q0 V% q2 S9 M1 Xvar copyspeed=marqueespeed: b5 `1 u4 I0 @5 Z3 z3 B: E) {! C
var pausespeed=(pauseit==0)? copyspeed: 0$ N) f! i, T. Y6 X6 S4 U
var iedom=document.all||document.getElementById
9 I7 t) F0 }1 M- f7 a( J, T+ }if (iedom)
6 E1 g- \2 G5 k+ _) ]( y1 sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): N# L/ P% L# @& S$ N+ f. T0 p7 ^) `
var actualwidth=''
$ u& A0 x0 E6 T% Dvar cross_marquee, ns_marquee
9 x3 {3 y- B, ], y; |9 z6 Q. Z9 V+ D0 Q
function populate(){
! o, Z3 ?: h) B1 G5 U9 `2 Eif (iedom){
0 \, p6 d) ~9 Q" K1 U9 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ `: R% m: K/ ?0 a6 Ucross_marquee.style.left=marqueewidth+86 t) D0 K2 P- d, M' n$ f. [
cross_marquee.innerHTML=marqueecontent
2 I. S) x. T, ~* z( V$ Z9 w2 M$ Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
u3 b' e- j0 f+ o9 c$ X% a}, L& C# T+ t- ^2 W' v \
else if (document.layers){
2 E* H; {8 V4 C" Yns_marquee=document.ns_marquee.document.ns_marquee2! i& l. Q7 J- L2 [
ns_marquee.left=marqueewidth+8
! V& q0 k5 S/ }6 V2 ons_marquee.document.write(marqueecontent)' @$ R: T7 p- H* S* F( |) }
ns_marquee.document.close()- |; k- c& |/ u1 j
actualwidth=ns_marquee.document.width
% o" X p( l! v# Y, p( H}
7 H8 `3 B5 f. y1 b, Alefttime=setInterval("scrollmarquee()",20)
+ l' j0 Z3 ?& k1 n0 }7 ]5 c" a}
& a9 F: h% i" B' `. h( F8 pwindow.onload=populate+ L! F! e [: z5 g+ F
0 k, ?9 W: @9 l, x( Zfunction scrollmarquee(){8 G0 x) z8 H- H; C+ Z+ Z
if (iedom){
7 x, `' ^9 a. ]8 _7 s: r: u; Y2 k- D' j3 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) ?- j$ p0 s3 y- fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% D0 g7 x1 v' [5 E4 j
else
; r2 S4 b, P" z1 j# L6 ocross_marquee.style.left=marqueewidth+8
( z- z9 i9 w; l" r: P A5 @. F: ~: ]$ E2 ^& k7 v9 T3 k
}; \0 r7 S( C1 f: u& i$ {
else if (document.layers){
" c% G) \/ }: L0 X' e% i/ `if (ns_marquee.left>(actualwidth*(-1)+8))$ {/ n2 m- }! y$ s
ns_marquee.left-=copyspeed% @& i; {8 ]- ]" ]! [* q. V$ V
else
0 U3 x6 f# N" _0 ^/ B. c9 Mns_marquee.left=marqueewidth+8
# v: E& o7 ~! q0 j}5 J& p9 A8 A+ G
}
" |( P( d, ?* u8 i( g6 d0 k) X0 Q# W4 T8 I3 D d
if (iedom||document.layers){
5 t N& t2 J$ I9 T$ ]9 Mwith (document){
: a+ {+ U/ j5 a/ {4 _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 E* G& e( u5 {# X& C- zif (iedom){$ {; O" v; {* J' Q/ B* m P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), O1 ~5 G! [! L5 e8 z$ [: g& e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 \. M. U* v: o( k x4 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 P# \4 t. [2 A% V: y- T. d
write('</div>')
3 y2 O( X. P7 ?# C1 B2 g4 V$ p6 Z}: L; A6 w( w) _; k$ i- \
else if (document.layers){! k. c, D& ?8 ^" f3 |- w8 w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( ^3 Z# G# i" h. ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 r6 f! \5 e" }2 ^4 I# Y
write('</ilayer>')
' G; a, H% p% ]3 K1 P}
' \; R4 e4 C2 B# Q! V' N, s% y3 Udocument.write('</td></table>')
S) I J! k4 a4 K0 R}( y+ S# L3 w* E: S
}+ J: p; k! K H" v
</script> |
|