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

|
网页之跑马灯文字特效
//修改宽度8 w; T. W4 }8 m' Z# k: T$ j# s
var marqueewidth=300' J: @7 [3 i: P
//高度) P6 b5 u: C# M7 ^1 K4 ~8 l+ y
var marqueeheight=25
1 S6 \" D4 \7 ^) d4 n//速度(1-10)5 c3 s7 }7 H- M$ r% V3 ~- i$ W
var marqueespeed=37 d( A4 r3 u. ]
//背景颜色 p" a7 l7 M* e. p4 v8 k5 d
var marqueebgcolor="#FFFFFF"0 {$ S' }. b! P2 G. K- f2 U
//是否能暂停 (0=no. 1=yes)?
0 }8 U# K4 O9 M4 Z4 J1 Y4 C+ C3 ivar pauseit=1
- h/ J. O: m' C. n
; p" t# J' b5 I8 @; ?9 _8 k- ]* w//修改显示内容
( n, h; S* k/ J1 @) M# ^' h) Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
{8 |9 y6 ?# n2 v/ b# o3 _7 J) C8 p$ _
0 ~; ^* O' m1 k+ E4 M////下面不需改变////////////
5 Z; P2 N% ?% Q1 g6 R# N3 W" s! B2 w( M: ]4 K
var copyspeed=marqueespeed
3 K! \+ v) Y+ M4 a4 @3 G; {" W& Rvar pausespeed=(pauseit==0)? copyspeed: 0
" k( V4 r, y2 Q$ j- L# S! G; I" hvar iedom=document.all||document.getElementById8 q' [+ R! C5 }6 y' b: A
if (iedom)1 j2 L& w. ~2 G: z# J# |" n A3 l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 f, L, o" N5 J$ R- N7 M) G7 z
var actualwidth=''
7 b* d4 R9 \6 h7 N( G5 a8 _var cross_marquee, ns_marquee
) N* H8 j- F2 x1 h3 @' I
# M+ ]- B& @! Z0 ^1 Bfunction populate(){
+ ` O! C3 L- ~0 eif (iedom){1 Y" }( q! R, w, m$ e0 s/ q2 j" Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 A* y- [$ l3 T- ?
cross_marquee.style.left=marqueewidth+8
6 L e. L! z1 }7 q9 ~# \7 K: |. F; Tcross_marquee.innerHTML=marqueecontent, T Q$ K$ S0 i1 }0 x/ ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! s$ G% h$ `3 g5 h$ D8 [1 \
}
/ A( u2 Q% n5 B7 F! eelse if (document.layers){: d4 l" Z( v! K- o# B9 \. J" F
ns_marquee=document.ns_marquee.document.ns_marquee23 G0 h; i; {5 V" P
ns_marquee.left=marqueewidth+8
0 J' _0 K$ i( ^6 d. E0 b, \ns_marquee.document.write(marqueecontent)# R8 K, W* [3 I$ L, J
ns_marquee.document.close()# [0 c* u) r, C
actualwidth=ns_marquee.document.width$ s# t, C/ K }7 }
}- ~8 y- |# H$ L5 q" s7 f7 J
lefttime=setInterval("scrollmarquee()",20)
5 D, h$ x8 S" n R% P0 R$ Y}2 _% y3 q4 G6 Z2 h$ ]1 B; q
window.onload=populate: S' D3 ? f' j3 X' \
% b% V$ f/ U4 i& F5 H
function scrollmarquee(){5 ~4 r. ]# m5 K4 C; I; Z1 u
if (iedom){
& ?& C9 H5 R$ M8 Z) @' |- \. C( E/ z& Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( P( o$ v* E: R: Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" H/ k2 I1 N2 D2 {) D
else
' z% @/ b# D8 |/ ocross_marquee.style.left=marqueewidth+8
w5 |* r; J- T, c4 m+ y0 I9 a7 ^+ p$ K! t& `, v
}; `( ]3 A! c9 c# c% E4 F7 a
else if (document.layers){
4 |7 O P3 K$ g' K% } _% ^if (ns_marquee.left>(actualwidth*(-1)+8))
+ d. n8 v( A( `+ [% Mns_marquee.left-=copyspeed
6 n3 t* M+ i5 o" P* h3 H* Nelse
9 y5 _0 m. Q8 Z; ~% z- fns_marquee.left=marqueewidth+8
! C) ~; J2 `. J5 A' T( Z}
2 l" w$ x( j# D% T& s}3 q& h, x; r, ]9 H
' j4 \ ~( Y' a3 N) q2 w6 k9 [9 \if (iedom||document.layers){
5 k- t$ d4 j* s0 C* I' |4 t1 Fwith (document){5 s ]9 P3 d) m- O' R: ]9 ^9 F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! B- ^4 j/ ^5 v( Q
if (iedom){
{; I6 k! @) u' `% G% n2 S! twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 y9 J2 n7 F; T# G1 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') T3 S/ L' w6 q. l! [ F1 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 e& w K0 r- d' A3 v
write('</div>')
4 N0 |: W: i5 K# u6 p. {: P}
. }- C5 g7 @; uelse if (document.layers){3 ]) y- Z4 b+ r$ T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( d' n2 w: p/ a6 @6 \0 ]1 lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# `" F) p/ x R
write('</ilayer>')' U) `% J# | y8 {3 @
}
6 o5 S- _, u% R) ddocument.write('</td></table>')
5 T! s0 [. s) T% ^}
/ ^, Y- i% j- F- s}
* f% A: S" v9 {</script> |
|