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

|
网页之跑马灯文字特效
//修改宽度
& [: @3 K1 H1 X# G' }. Q3 q' p' Fvar marqueewidth=300( |5 V" x* g& }( c
//高度
{' z3 C7 U5 B, ]- Jvar marqueeheight=25
; l2 j" L A* u- ^//速度(1-10)
6 N& i# d# H( rvar marqueespeed=3
5 o3 t6 \7 z5 H9 A//背景颜色
9 i$ k3 P8 F }$ A8 \/ ovar marqueebgcolor="#FFFFFF". a/ ^9 Y6 w S9 D' a! p; x7 o* v
//是否能暂停 (0=no. 1=yes)?, s- K' d/ H7 l
var pauseit=1
: C, r! \: \0 r# N6 u# ~0 L5 R! L/ ?/ T% K X# l
//修改显示内容7 \. w. B# b* o% `" y* _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* M p0 U5 w9 e e2 g; Q+ |
! z9 y5 g; t: r$ n6 v5 O
- T' R( q. c' t8 m( ^! m* n////下面不需改变////////////: S; b& V( S# ?2 X' G
5 U4 y6 h9 K5 y& W( [, yvar copyspeed=marqueespeed
9 N" @) o. |! Z) tvar pausespeed=(pauseit==0)? copyspeed: 0( H% \6 a0 ^. p$ A
var iedom=document.all||document.getElementById% s6 o( _+ _ D& l
if (iedom)
. ~+ w" \, E y' V/ t7 C; Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ E4 w( C' P% E# }var actualwidth=''. G3 ~+ K( l1 G" g& r* ~' E
var cross_marquee, ns_marquee( g6 E* e( e+ O+ T0 `( Q( p
( l( G8 d: ?0 n. bfunction populate(){
3 @/ \7 s8 r; P' [0 ~6 `if (iedom){4 k7 y, g8 H, C; g; I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* K- i Y9 x! Q8 ]) F' S9 n3 ycross_marquee.style.left=marqueewidth+8; E. B( T5 S3 L8 m+ F T# q
cross_marquee.innerHTML=marqueecontent6 u9 r( I! ^& A* g7 S4 T6 i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; Q1 l T/ W7 m7 k+ P1 Z
}
: A, j6 {( D9 r5 I! w; y: j0 qelse if (document.layers){
" L! {. D% B6 `3 K, nns_marquee=document.ns_marquee.document.ns_marquee2; {& A9 w* a0 g* f, h5 k
ns_marquee.left=marqueewidth+8
: _" P* t0 B! t/ I: jns_marquee.document.write(marqueecontent)
7 P! B. S5 d* k7 [ W6 S3 K& Fns_marquee.document.close()
* `4 Y, ?. l( ?1 N, Mactualwidth=ns_marquee.document.width1 f$ a! x2 g1 Q( u
}
( ?) D7 p# g' u4 E7 O+ Q9 zlefttime=setInterval("scrollmarquee()",20)
+ X `- i8 C1 f, M; [}/ d7 _( S3 j$ C9 c) \% g. p, W
window.onload=populate# P( k: d9 R9 h I
" q5 P0 L6 `. s8 K; X7 A$ n) p. R
function scrollmarquee(){1 T: C5 m( L; E- O
if (iedom){
0 W' ~8 i! S1 Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 Y; R) R8 M) S& P$ ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) D! L- S7 Y" p. pelse h+ o2 C' T. P' S
cross_marquee.style.left=marqueewidth+8
v# u6 L: {2 z% m( H, a2 G. |7 Z. J5 y
}# N, ]$ r1 n" Z- t* }* e
else if (document.layers){
, Y! I4 N) g! g# C6 f, Q# x+ Aif (ns_marquee.left>(actualwidth*(-1)+8))' w2 q( }# D' N5 l' w) b. f0 Y
ns_marquee.left-=copyspeed
1 v9 [) s. y) |/ welse( M) l; V$ `* d( R: G/ k
ns_marquee.left=marqueewidth+8
# l1 ^$ f/ J! p, h}2 B. D3 _) h2 O0 t' ?' F8 A
}7 _! N. c8 q* T0 e& N5 |
: k8 O* R$ C3 N; K6 @
if (iedom||document.layers){
! O$ S& r% @8 R9 f Rwith (document){# J' g/ |3 [7 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" h# F0 X: c2 z
if (iedom){8 Q" ^1 `3 q" Y1 ^5 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( J- J/ a# F' R3 s0 Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 v& F/ W( T% s4 Q4 \* C: t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 t( D/ j7 U: n7 g. O& {! x' I; s
write('</div>')6 \6 `# }1 m8 X5 L8 k% V! K
}
2 t( f X' E1 ^* ]; Gelse if (document.layers){
5 {. H+ P$ a, _5 Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' g( y& T( @& ?& d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 i, \7 {( o' K2 O% S! twrite('</ilayer>')/ a7 v/ u2 z+ k2 m; p0 x. V
}
6 h* M) ?; I9 L! q' _ h( Bdocument.write('</td></table>')* K. o a. D- b+ K6 N- x! b
}5 R2 _/ ^% |2 `2 l: j0 O
}
2 z( n2 O. l$ X6 K* u7 i+ D</script> |
|