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

|
网页之跑马灯文字特效
//修改宽度4 g8 r1 u; }! a; t2 f# N8 y
var marqueewidth=300& z0 `5 `4 ^# E
//高度
t/ Q8 T- F0 h, m7 p6 e2 X4 uvar marqueeheight=25
, `, F" Z, w7 Z! U2 u//速度(1-10)
3 t8 }3 w: H, i. ovar marqueespeed=3
( r! m9 s/ \2 J- `+ j//背景颜色) b5 w3 K7 E" E9 x+ y8 S
var marqueebgcolor="#FFFFFF"; c# t+ D6 }4 r8 o- C1 Z" i( s0 Q, G
//是否能暂停 (0=no. 1=yes)?
) j- L1 E9 Y2 I+ ?) R. wvar pauseit=1
+ u" L" N6 G( l1 i) m; E9 e# g2 S& U/ x/ b9 M# r2 Y) u
//修改显示内容/ e z" I8 d; v U( @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 j7 N9 C' g9 E% o7 H: K% y* V- M, _ c; Z: D+ P
9 g7 s) _1 ?7 L# n+ D////下面不需改变////////////
. p! B0 G8 Z, f$ Z& C2 H! P: L# g6 { P/ n4 ~* [4 J x- K5 D
var copyspeed=marqueespeed
d3 f0 t$ q/ c* z! j3 hvar pausespeed=(pauseit==0)? copyspeed: 0
p( v5 l) U W- b0 R2 ivar iedom=document.all||document.getElementById
& H' o0 R3 t# z4 O' Y8 Gif (iedom)9 u! k" }& h/ [2 V5 P9 y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 I7 @0 L X2 o2 k
var actualwidth=''
& \* f, j& n- R. f$ ~( y* z8 R, qvar cross_marquee, ns_marquee
- B: F% T) d) {" _: |+ O; H
* m$ R6 g4 }% bfunction populate(){. a& w9 k- y( `0 F* O( C' ^: h
if (iedom){) e; i8 i- Q) @, S& `' e$ G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. e: u1 g' I% @2 ~# b
cross_marquee.style.left=marqueewidth+8$ e7 _. t/ e+ g1 @
cross_marquee.innerHTML=marqueecontent; R6 z$ M. R! j2 ]3 o3 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 S0 v, M# ?& `, z$ B* d' r/ \7 Y2 p
}* p- A& K b; H, N
else if (document.layers){: ]7 I. ?4 N f' k
ns_marquee=document.ns_marquee.document.ns_marquee2
: @5 a9 h2 y; y$ A/ Z- X. c( E( Xns_marquee.left=marqueewidth+8/ s' \7 O% K, w+ B+ p$ _
ns_marquee.document.write(marqueecontent)
( L6 b- P2 w. T5 h8 Fns_marquee.document.close()
# Y9 m6 R: c+ w, gactualwidth=ns_marquee.document.width
6 L/ T1 j+ V5 `% m% I8 v7 q) P* r7 B}* X7 @6 t% T' c" Y: j2 D
lefttime=setInterval("scrollmarquee()",20). T8 ^) s3 B, Q. t! n. z5 s
}! J. v9 R. O; \& J
window.onload=populate
) ?0 u7 u; X; \0 n- F2 d3 g5 t. W& @+ @: P y
function scrollmarquee(){
! W4 q8 q9 k( d& y8 }' S( @0 Uif (iedom){7 z+ i9 S; }1 S# k5 u, Q1 b9 @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ g n: z* m: B- ^( }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 r( O1 ~; |) P2 Y9 ^
else9 [4 W/ l1 e0 H3 J9 _9 c
cross_marquee.style.left=marqueewidth+8
, m$ `$ O: N F2 l# S! ]6 H
" B+ m; Y' F+ i. z2 m N6 }9 C5 a}5 N z* X& V# y% G3 a, d
else if (document.layers){7 t: Q9 a1 a% W$ ]& L9 S0 l( g
if (ns_marquee.left>(actualwidth*(-1)+8))
; a* k. p8 ~8 B* Q3 I% \ns_marquee.left-=copyspeed
( n1 {* `0 }1 `/ |) V! zelse
) v- @- g. o$ z: pns_marquee.left=marqueewidth+82 X3 j# M2 r) T- Y5 Z; j
}" c3 w. j5 p2 Q# r' o" G
}
b$ o( l5 @8 B B/ b! U* a3 ]9 Z; @& {" j" h& F
if (iedom||document.layers){
& c. N: [+ f4 n1 L q( [with (document){5 {+ Y" _7 r3 e: F0 t; M" L& k; I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 L* c5 Y1 X4 \2 G0 f
if (iedom){- k t. @( F6 [0 ?8 v! L* R" L: p" M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ S4 H3 S. s4 a! i1 O5 k! G- Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 V4 M; [7 m# z, H- }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ g. t3 `5 s. L* }5 E% y% vwrite('</div>')
( D" ^% J s: k. c}* j+ B" a( b) e$ _: \( O
else if (document.layers){
9 L# } F3 k8 c6 ~; c4 X; ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" x+ S4 t' H6 c) d% f! Z) C$ ^! ]2 _; E* Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! B; ^ V% ]; u8 r! _* J1 n3 v
write('</ilayer>')
: }4 G2 Q" Z; d4 v: ?" z( @% e}
" Z0 L- `$ [! L- D* C% f# x; gdocument.write('</td></table>')
& Z! A8 A' _2 @& m; v}5 K3 m6 g1 t# _1 ~- z
}
8 |6 ] ^$ ]1 c6 b</script> |
|