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

|
网页之跑马灯文字特效
//修改宽度+ H- p! @% c8 r0 }0 m. D
var marqueewidth=300
. w, n% a; [7 z y! C- y//高度# w& }. u+ b) S1 w9 D) w) H2 d8 X, W
var marqueeheight=254 c C$ u% L% \9 ^+ I! g% D
//速度(1-10): J+ b5 w8 g6 }. `+ f1 u3 d
var marqueespeed=3/ m _ I& ~( _9 ^1 U: h
//背景颜色( J; T: P" v+ A# k
var marqueebgcolor="#FFFFFF"7 K% E5 i. R( v$ r3 ]5 D! L
//是否能暂停 (0=no. 1=yes)?
6 t. Y/ j# |+ P8 L) j, fvar pauseit=18 d+ q& B0 ] F' j6 {) u
, Z/ l! B' p6 F0 `2 m1 W, [3 P8 z0 j
//修改显示内容5 e- @5 u1 j& f; j' m2 N4 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- P3 h. Y5 K1 N* Q4 I& H
" C' M {) q) g. I6 v4 e9 V8 G* w" k$ Q: Z8 n- W& ]$ Q9 P9 X8 ?
////下面不需改变////////////% y, q" x" B! h% Y9 ?" e
# w% V, Q3 d. f4 }/ f, S- w
var copyspeed=marqueespeed
1 T6 h& t# \3 z% D8 w( H/ Uvar pausespeed=(pauseit==0)? copyspeed: 0
- I1 b1 D4 C% f" b' d; i9 ?var iedom=document.all||document.getElementById; V- `, ~. g7 y: m: _! f7 ~" A
if (iedom)
) Z% V, g3 a4 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 a! p9 @- V* v4 uvar actualwidth=''
0 f8 _' @3 ?% |' s. s8 ivar cross_marquee, ns_marquee8 ]9 W; R4 z( N+ A/ ^. W
1 j7 a% U" ^) F6 k! j+ D
function populate(){3 `# D+ V8 R1 r3 z r: l
if (iedom){# j, ]5 J. J2 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! o, S" C( { T2 p
cross_marquee.style.left=marqueewidth+8
0 t; S$ ^ h' A3 Dcross_marquee.innerHTML=marqueecontent
% z+ d8 x3 O! \! h% k% Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ }! L A( G) I3 m! f}2 p4 C4 q, Q$ K* w! c4 L
else if (document.layers){
+ P1 T, j: @' V1 ons_marquee=document.ns_marquee.document.ns_marquee2
9 S) S5 n) p% n: a' [$ K, Ens_marquee.left=marqueewidth+8
1 I4 v% I1 i" L" S8 T- r8 C) ?ns_marquee.document.write(marqueecontent)8 N0 v" z* o# Z8 Z6 g
ns_marquee.document.close()
; G- x8 i3 n' W6 hactualwidth=ns_marquee.document.width, E! C D- B3 A- p: Q
}( Q5 y( e* n7 q
lefttime=setInterval("scrollmarquee()",20)
& G! i" f {7 [% b4 x$ p1 `}
; v9 D( z0 x: h7 a, Qwindow.onload=populate0 t6 |) B* B+ `6 U
+ E y2 d' h% O) K
function scrollmarquee(){, l! z7 i- U" u1 ]1 N, J
if (iedom){6 j" E G5 u- T( w0 i/ u! f, F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* D9 z, c1 T: k7 ?) c' i4 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! o# X9 {3 ?, f# l1 R: D5 }: k4 z: j! g
else' g" {5 H! Y; X5 E) V W* a. A
cross_marquee.style.left=marqueewidth+89 d6 X. j6 `2 m! b9 b0 u" w
5 x3 A: p% J( `% f
}
& M3 v; |) h, j6 b- a& `5 Q zelse if (document.layers){
4 E( x4 M5 O$ a7 ^if (ns_marquee.left>(actualwidth*(-1)+8))$ Y' f0 X' w- a: y0 Y) |4 S2 t
ns_marquee.left-=copyspeed
7 e% }" t" i C( b) kelse
7 d* w3 O; d9 T2 M0 L% C( J( Mns_marquee.left=marqueewidth+8
! g' i2 N2 O! b! ~" U( B}
' B# X) W. o0 \/ D1 V4 K y' p# D}
' \8 s% W O) D, s3 s, F+ y9 M; }7 c6 R
if (iedom||document.layers){
: n9 I4 R! g! Y9 r: @$ e, r. Kwith (document){
. [0 v1 i! O, ~4 ]9 I, U7 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): D( p$ u8 m, q7 p& A! }8 ?
if (iedom){5 `8 w9 q1 w1 }. N1 y; ~6 q9 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ s6 f# A, s4 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 r5 P' i5 Q/ g2 r) Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 E' Y: Z( f4 \ J, [
write('</div>')
* P7 t$ o# s1 a9 O) [}
: ]# \, j* @$ q8 a* N, G" Gelse if (document.layers){% d6 m- L4 _" y! V. [5 l5 t" O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' p( I9 n+ \& ^* I' w! m1 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# \' K y) d5 e5 E
write('</ilayer>')9 D+ T+ E7 K. g+ g( Q# A( k
}
8 [! V( V4 o8 Z" B% m7 q$ A, sdocument.write('</td></table>')
8 A! w* u2 @, {) }0 p$ T6 F* j( b}2 M- ]$ k: h3 [! q( W# n1 Q6 G+ Z. A
}
; O- B6 N* v+ v8 h( c( E</script> |
|