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

|
网页之跑马灯文字特效
//修改宽度+ @/ A, x0 G# x" O: P7 `$ U
var marqueewidth=300 k# o5 w; f* i( m0 r5 E
//高度
/ y/ p+ I4 ^' K# q1 t- ovar marqueeheight=25
' @+ V4 y( J9 U! `//速度(1-10)
6 T$ A* I* q, j% i5 H9 Kvar marqueespeed=3- U" t% y: U1 N
//背景颜色5 f% t' g( Z' {
var marqueebgcolor="#FFFFFF"+ {! T0 |& l- u+ x0 x X) y
//是否能暂停 (0=no. 1=yes)? S1 h0 Z7 s- i7 Q0 ?5 ~. u
var pauseit=1
" L4 Z t) R. W. z' R
. b; t5 W6 X% M T//修改显示内容
" {4 h( N1 L3 a" qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ g5 N% a5 P7 A3 P) q' r2 m; X7 Q8 W. Q) }2 f
1 {* \, f/ m. J& l////下面不需改变////////////
1 o% P6 {3 X! }, B: T# Q$ u( }
7 \& W. p% t( f* N6 ~: Jvar copyspeed=marqueespeed
5 N+ Z( K2 J7 \. R7 {8 t8 V: Bvar pausespeed=(pauseit==0)? copyspeed: 0
" C9 L* _) p2 m+ `" v5 R+ H. b7 fvar iedom=document.all||document.getElementById+ F: w' i2 h( _$ n1 ~
if (iedom)
2 q m. Q8 K; O4 r9 `7 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 e* a# g0 P- b. U" y7 Rvar actualwidth=''
, _+ _5 r/ s: a+ R: x4 S7 kvar cross_marquee, ns_marquee% s- M- ^. J( J9 I
& E; |& l+ h. u% M. @
function populate(){
. E. S( w# n0 `/ r& ~" X( T! yif (iedom){5 l7 c. i7 R2 J( t5 b {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ E+ T/ K W5 Y
cross_marquee.style.left=marqueewidth+8
2 i$ |, J3 V. _cross_marquee.innerHTML=marqueecontent. Y: z( B" ?6 ~: Y' D6 ]# `3 g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 _& {% ]6 r3 X/ R l9 d. X) h' T
}
, K2 _9 K0 q9 ?6 ielse if (document.layers){
t( ?4 z" I- W* V# v* H# Cns_marquee=document.ns_marquee.document.ns_marquee2" n6 ~) R+ O. E: A
ns_marquee.left=marqueewidth+8% B- y3 s6 V& ] V; v) J
ns_marquee.document.write(marqueecontent)5 k* W% _) ]3 ^3 g
ns_marquee.document.close()
3 @8 f& ]* J* U f A' Uactualwidth=ns_marquee.document.width
6 w" |* {3 h$ d6 Q W9 V0 H+ O}
0 n! U1 @8 L* h6 K3 g2 Q# E W, Blefttime=setInterval("scrollmarquee()",20)! E0 ~# N( X, M% o/ j
}* j. O' y8 K( ?" _# C
window.onload=populate
& ^ J8 L, k+ J
$ [- t' I+ ]" ^( {; r% Vfunction scrollmarquee(){8 t3 x9 v; @: p' O
if (iedom){7 k+ W7 t" X: s q4 M, R0 S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 Q( i% Y( k- P- w5 `2 G( [. N4 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 K b0 ?$ p+ q8 J2 U. g
else
, U& G( x& S; K" V+ o' a$ T& ccross_marquee.style.left=marqueewidth+88 y+ s! B& _, W' V$ t
G' p! H1 G- Q
} e' |0 v: S( i' [7 V
else if (document.layers){. e6 V0 N5 P2 V
if (ns_marquee.left>(actualwidth*(-1)+8))
) v0 _! X8 D3 d, a$ j6 w g: Vns_marquee.left-=copyspeed
" q2 D* V- _$ X7 j1 i% @9 relse
$ o& w! N9 y. k1 h5 f( nns_marquee.left=marqueewidth+88 }9 z# w" M+ r& `# \' ^4 d
}
/ O5 a9 f, E" H2 e}
% z: s$ K, k. u2 F9 t. ^8 ^% ?/ Q3 \* k
if (iedom||document.layers){$ p3 B& ^& b9 o3 a! ]
with (document){
+ S5 p4 l' J4 @% ~7 z: C {$ Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% _% q% k7 V& q5 Rif (iedom){% H/ T( I I' p( n6 X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, O1 F# B( c8 B4 Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! N0 e" \+ T9 C& x4 X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) N3 ~, i% w" b+ B% J
write('</div>')% Z( J' `$ Q* Z6 J
}
4 n% z. J" y( w [" \else if (document.layers){
/ a) b! s" o) t N* p. H: m1 U1 pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* K O' t4 x$ Z; ^% W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ `# s* `) J9 J! T6 z
write('</ilayer>')0 G# P+ X& K4 h% N1 L s; `
}
0 o2 r7 g+ j/ K" F' x! g: Udocument.write('</td></table>')
/ X1 N7 Q) j/ y}
g1 h0 |2 y6 M; E6 S}
2 J6 o+ T6 @! R) e" H# L2 ^</script> |
|