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

|
网页之跑马灯文字特效
//修改宽度
+ p% N% E' v" i" I" D* O9 Xvar marqueewidth=300- @* X* R5 A8 u& M
//高度
9 B( s* v: U9 B0 _4 z. |( ivar marqueeheight=25% ]& M5 ^$ p! t
//速度(1-10)
& F! s/ C0 a& g) \var marqueespeed=3
9 |8 y6 I4 t1 h, ~5 h//背景颜色
1 F6 B' l$ P1 u1 j# D0 Pvar marqueebgcolor="#FFFFFF"
) F9 y6 @6 {: X- U* ^//是否能暂停 (0=no. 1=yes)?
: O; W* k6 W9 U O. u4 dvar pauseit=1
* G, _+ Z+ F; j, i9 W/ T# d Q* M- G8 r- w
//修改显示内容* i* z9 @, }. C6 A- h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 t' |' i: ~3 @! b- J3 z" E( i# x
5 v' K9 j: i$ b( p3 b, T& Y
% B. Z! t' s' c) o5 p, e" u' M K. k
////下面不需改变////////////
e- X: T( T4 L! K" N" L3 {
1 V- n) u) S/ l7 @# L: ]* Tvar copyspeed=marqueespeed
& N# [/ x: t1 V- ?* tvar pausespeed=(pauseit==0)? copyspeed: 0+ s, w( J, ^; o% J9 e! x
var iedom=document.all||document.getElementById- n- N, t9 S. w; c: b" ?
if (iedom)% R8 w! W& a1 E2 w) t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' L" Q8 E; g5 _! I* q5 c# {# P
var actualwidth=''
+ r+ Q. `, b( k0 \* f9 L- f7 q7 Rvar cross_marquee, ns_marquee
) S" M2 M/ R1 a
# I" c; [+ R9 D+ L& w8 m& `( yfunction populate(){# h! }% z$ K; I: p
if (iedom){
, Z+ h3 R+ S( w' Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) a6 V. F6 e0 C2 T& l- u* ecross_marquee.style.left=marqueewidth+8# G- k9 x7 v' L8 F1 X* M* y" U
cross_marquee.innerHTML=marqueecontent& R0 ]2 ~" K8 k! E5 e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& y3 o2 o- W* ~$ t/ O}
' x0 |3 p- R; s% \, S% V8 eelse if (document.layers){% M( X* f5 ]0 d8 l/ j3 b, H! X
ns_marquee=document.ns_marquee.document.ns_marquee2
$ p: Y3 g& `. G+ jns_marquee.left=marqueewidth+8% s7 T" Y# {' x, D& K
ns_marquee.document.write(marqueecontent)6 g/ y# f/ h1 f+ A# F
ns_marquee.document.close()6 u1 q. y* @6 d/ i
actualwidth=ns_marquee.document.width
( ? p' Z. x6 v7 Z( S}1 R5 H$ U* x4 @" x( C5 f! ^7 D9 a
lefttime=setInterval("scrollmarquee()",20)
8 V# G' Y b0 n8 P& |5 ?4 e& a}
: C& [& N- S) C/ x* mwindow.onload=populate" ~1 J& D7 z3 q( z. |
+ A8 ^( @; S% |& A
function scrollmarquee(){7 f: E; o+ L+ U
if (iedom){# w3 M/ r, a4 m+ _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 n5 e! l" j7 Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 |, q1 |/ } y: \/ C* N
else9 d+ A6 a5 c: s- o, x
cross_marquee.style.left=marqueewidth+8- ?( ^9 @3 U/ U' \/ ~% k
, D+ {' `+ u) D
}' f4 l. r2 n+ ^, y! |# p+ |- B
else if (document.layers){
5 a0 `1 y$ \! H9 vif (ns_marquee.left>(actualwidth*(-1)+8))
7 F" N( I) }3 Cns_marquee.left-=copyspeed
& v: s" `: p) Q" P+ xelse' T2 M/ l, w9 k. d; o
ns_marquee.left=marqueewidth+8
3 Z; W2 D Z# a1 C+ S6 |}9 [) A- z1 v( a- ] V
}: f1 L3 W4 w2 @
' m6 w: M0 \6 o) _if (iedom||document.layers){
q9 H3 @+ K) swith (document){
7 I8 @7 x" A( f/ c4 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: B* ~" f4 _* Y7 [7 T& ?7 Cif (iedom){
0 b* r' X4 {3 H" s" W* I/ {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; M/ k) m j3 x- s. d* rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 J5 N5 [9 o; f& M/ H6 M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 ~: o: O8 E; q" t6 k- W n/ O
write('</div>')
! ?) W' `: S( l5 P}
% Q5 k, v8 a0 {! o4 z5 felse if (document.layers){
) B5 I5 J+ i0 p' M- s rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' e- D `$ a; K9 C! l. Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! q0 v' o5 D" X; z
write('</ilayer>'). O" U6 Y/ |. K; Q
}
. A7 m! b Y# l9 B8 N( J9 edocument.write('</td></table>'), p5 V# `* N, o
}) H9 v! T1 C: |$ Y
}
( ~4 g% ~/ H. x7 ~</script> |
|