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

|
网页之跑马灯文字特效
//修改宽度
) C3 Y' {+ j7 Z1 }: ^# {5 j# W0 Pvar marqueewidth=300( b W( d M7 f+ S- v+ N
//高度
1 D3 r. q" t6 h0 ?1 Gvar marqueeheight=25
9 v8 P6 \, M% [//速度(1-10), f: F/ \: N" }
var marqueespeed=3 W9 d& U5 b4 E" H% R$ N# A
//背景颜色
3 n3 g1 y+ ?2 g1 Svar marqueebgcolor="#FFFFFF"# f6 [, R6 J% l( J. e7 m! B
//是否能暂停 (0=no. 1=yes)?6 j! }# @1 x: A; `% K
var pauseit=1
) V/ o8 {2 u7 B1 C) G) j
! {# B8 I/ F) [6 ^//修改显示内容. A. X/ n1 s/ v- p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% U& E: h( B, h9 N6 I1 G0 J
' R/ A, ?* i% V7 r# c. C( H
+ h- W7 D3 X, h; d3 | `////下面不需改变////////////5 V; O0 {0 Z- N/ g7 W( ^
. r R) h3 |: ~7 L7 t" d
var copyspeed=marqueespeed" k! v3 t5 c5 p1 B, M3 \- a
var pausespeed=(pauseit==0)? copyspeed: 0$ _1 s b& }: T+ O: b+ i5 Q
var iedom=document.all||document.getElementById
9 b J! B' H' h4 n! sif (iedom)
) Z2 h$ @3 y/ T% g' c8 ?( [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 ^8 b) h: u ^var actualwidth=''; ?" m$ N! s' Y1 h" O" v# F$ A% ~ f
var cross_marquee, ns_marquee$ \ Y2 F% }/ s3 T, S' G
2 V+ W/ s3 p% X+ Kfunction populate(){
" {. `( p @0 X" c' s, Mif (iedom){
, d4 w0 r1 A; Z, R7 E5 e; kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 R6 q3 f' s1 d' K7 X
cross_marquee.style.left=marqueewidth+80 q. s* g& Z5 J! Z a
cross_marquee.innerHTML=marqueecontent0 I( v# I* I w" ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# h4 X3 A5 {) p: j8 _, F
}5 v6 o9 m; |9 M! J2 R, X
else if (document.layers){
v% \6 i- O) A& h% Qns_marquee=document.ns_marquee.document.ns_marquee27 Q( X; ^9 i/ P2 B7 {- p4 L/ _
ns_marquee.left=marqueewidth+83 }) P( n* W0 O. Q$ V
ns_marquee.document.write(marqueecontent)8 a( c. H- X& Q( V; k- @
ns_marquee.document.close() o" l1 V) s, a: a
actualwidth=ns_marquee.document.width
1 Y. E! L6 \- O9 Y6 N. ~}1 g: I6 x- p. }6 ~5 i+ H
lefttime=setInterval("scrollmarquee()",20)5 ?3 y# C- y& M/ Y8 e8 ^
}
, z( h8 `* b2 Y* Q& w3 n# dwindow.onload=populate
( I+ Q4 h( C+ T) g4 Y7 Y& D) f: d9 H3 f& ~$ x* f
function scrollmarquee(){
8 \0 |: E( T9 Q% @) }if (iedom){
/ L% \2 F8 n% G% e; k' rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, L; }, V/ M0 Y( E) i) `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" F3 }$ H2 a) ^0 p9 T
else) _$ r2 a6 W5 r: K
cross_marquee.style.left=marqueewidth+8- f, v. s+ C) O' B( L1 y% o
; d7 J( x5 f, s$ m3 ~/ D! S
}
, e7 s& i1 w4 e4 Z6 l% Belse if (document.layers){7 p1 Y, G! t9 I7 g9 @
if (ns_marquee.left>(actualwidth*(-1)+8))
+ L1 C" r1 I+ K( Gns_marquee.left-=copyspeed
4 X# m8 k! b4 C5 N8 B8 ~else
2 x* H8 J# W' q- ons_marquee.left=marqueewidth+8& a4 t2 N, [! ? g5 y j
}
D) w9 N! @1 W6 k/ R) T}
- e5 ]+ Q( T0 w8 H, L& B, Q& U7 R/ c W( p& l- w" }
if (iedom||document.layers){
1 y* e6 x9 \3 n8 zwith (document){
8 K/ d8 g6 u! Q$ fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); f# |/ d7 ?- L+ X4 a8 x
if (iedom){
* z1 ?' z, X9 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' ?4 w" a: P8 M( z# C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& B4 v1 F4 i* F' x7 r1 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, v# y% M' L3 u+ ]! q4 G. _' xwrite('</div>')# d2 O _" g+ W
}
' _2 Q. b: C! g) ?else if (document.layers){3 | Q+ g3 ^2 \" q" S) x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). t$ F( h% m7 h. ?( W3 Y, R* U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 k _6 ~; e$ L" b; ~! p1 C% Bwrite('</ilayer>')
' h: P3 _9 J& M a; R}
5 x0 j* F# }! rdocument.write('</td></table>')
- h7 O& W# h5 |4 y% |1 {}
% d5 _) n4 W+ M; k}# c5 M1 H/ w h% ~- \
</script> |
|