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

|
网页之跑马灯文字特效
//修改宽度5 M$ l3 a$ Q) m- Z2 s
var marqueewidth=300
! n9 g8 Q& _$ q/ _* y+ M& n//高度
3 P- r$ @4 E0 _/ M, Y( P2 c. m! l. jvar marqueeheight=25/ y8 l$ {9 ]# H0 U
//速度(1-10)
* V) b' T! ?- g# h9 l2 m1 ?var marqueespeed=3
5 j! E/ i, }% r; A//背景颜色: S1 S1 A" a- ? }. I5 L
var marqueebgcolor="#FFFFFF"
0 D$ S& b' d- D: f. E4 u//是否能暂停 (0=no. 1=yes)?
! I6 I$ m2 v5 _( J8 `( V1 lvar pauseit=1
5 I# e9 ~* |* y( V0 c8 _: T6 Z
/ v0 |4 |/ }+ E) q4 F+ s//修改显示内容
! W! C8 K+ o" W% l+ s5 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 v# D; D4 o$ y) @: }% W8 }
! J; [, l1 D+ ?' _$ D" V
3 P( ^( _; w3 t/ ~0 ^
////下面不需改变////////////
4 W; Q, u7 Q$ Q. E
o& z1 O- c% S4 Z; |) P; c) L. \var copyspeed=marqueespeed) [8 a+ ` N) Q4 c
var pausespeed=(pauseit==0)? copyspeed: 0
$ T7 y L+ ~4 M0 W" g, Dvar iedom=document.all||document.getElementById& s+ J) Z0 k; r& ]- w7 R
if (iedom)
4 j% L. G+ o+ j3 x1 v5 h2 x% Q* fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 v! P+ p# h6 p: ~5 Q- ?8 e- jvar actualwidth=''* t+ l# y y }# Z2 u- s/ u! L
var cross_marquee, ns_marquee8 \# M7 {& r: h* z! E+ k* h
/ h1 j( G& K- U; ?0 k8 C
function populate(){ \9 n0 n. l2 X, H+ ?: e+ Z1 j: V/ P
if (iedom){0 ~$ k6 U3 t" P+ `9 s/ y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 O6 V. v( P) K5 t* l! N
cross_marquee.style.left=marqueewidth+8
% t$ \& b& L: |6 Zcross_marquee.innerHTML=marqueecontent7 J9 o; d: F9 r9 ~) m) Z+ M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) H5 R% ^! u* ^' n" t
}- w) ^) e( s- B; q
else if (document.layers){
1 v6 \, q8 x6 u& Wns_marquee=document.ns_marquee.document.ns_marquee2
+ g( |$ q$ a3 H6 ?$ Tns_marquee.left=marqueewidth+81 I8 D# S4 y( b* X3 ~
ns_marquee.document.write(marqueecontent)
; q6 S1 j4 f1 ins_marquee.document.close()
7 ]3 t0 g- P4 N" W' Kactualwidth=ns_marquee.document.width+ P, {7 L; U6 i. W
}: l+ c. E5 \5 y ]4 \& x
lefttime=setInterval("scrollmarquee()",20)- K, q# ^1 A0 H2 U: [
}' f: w4 k+ c8 ]6 p' `1 l
window.onload=populate( H( g; }, a- ~9 Z! u( I
) J; f9 ]' w2 q* m' I: Y Wfunction scrollmarquee(){% i7 {5 w4 Y8 |! S
if (iedom){, x3 B7 P$ m0 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 _0 C4 z( v* j q; B7 i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 G/ y6 z! }2 u+ T$ ]else
. ^, m2 J/ ^- j1 a1 G& Qcross_marquee.style.left=marqueewidth+8' Z# `- o, E o
2 P" k% E; M( a s
}
3 S6 ^0 [- ^1 g- { W1 J: i i3 Delse if (document.layers){
% o* B3 n) z8 Y* s" q4 bif (ns_marquee.left>(actualwidth*(-1)+8))
' I9 ~& L3 t) A8 k0 q: x+ ]ns_marquee.left-=copyspeed
) a6 d4 { K z7 f/ felse
' T! E/ X0 v c! d5 ?1 _ns_marquee.left=marqueewidth+81 w: x' s& `$ t# R" ?
}
8 W( I" x( D$ G* h2 C}
8 U! v9 a5 B! f2 R& A# y$ a" b% ^. P7 w( E# n( F! Z5 A. c$ V
if (iedom||document.layers){ R' i4 X, k$ m7 T, P6 `
with (document){
. L8 c! @& \1 b" F( p; W9 g }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- N1 D% o0 ?: W) y+ k; U% @if (iedom){* n4 G8 k' G/ A: h5 z7 ?# j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& |) g. j$ l9 y, w) E1 |* _ \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# s6 x2 G; n; i$ g5 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! M. \- V+ d* s8 j& S- q* xwrite('</div>')
% s4 S5 X! Q: t1 V+ [+ V" q}. k& w+ D" N, \/ L2 c) X
else if (document.layers){- W5 V: U- i; t5 k/ ~7 b. q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). @* ]5 ], H8 ~8 k$ o4 W1 k4 w$ z; l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* t" @# [ m7 z: H6 z% Uwrite('</ilayer>')
& f5 v& q: }) s( l: }4 g}0 n& M8 {! m# R2 T3 q
document.write('</td></table>')# H0 }0 e4 W4 E8 v
}
! j/ I& _: g" T: F}
9 r) L- }: \' c</script> |
|