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

|
网页之跑马灯文字特效
//修改宽度: ^+ y$ v& J- `, }1 x
var marqueewidth=300
* G8 ]# \1 W, p; U' a) y+ x9 C: t) ]//高度
, P% u7 q. X8 E( P l) C ?var marqueeheight=25
- l. L7 n$ E4 z8 _: E//速度(1-10)% ^3 K/ j* W; }( V
var marqueespeed=33 Y" G7 Y/ X8 w9 g0 }' E/ |" K
//背景颜色
: p2 u" e( S8 E8 {% nvar marqueebgcolor="#FFFFFF"- ^- q, H3 O* m7 `4 C$ ^+ s$ _& ~
//是否能暂停 (0=no. 1=yes)?
. s1 f4 |& K+ S+ P: c* X; N3 B% vvar pauseit=1
; N+ O6 v: ` Q# ]3 W
/ g2 u* [# t: O* k6 Q. o//修改显示内容# c3 [- z/ o7 n) a9 l1 m- D4 G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 A; c* J: @6 l! a; @- X
9 }! { [1 A" [& B1 [, t* b
# @; T& U6 k/ X/ W( \2 v4 X////下面不需改变////////////; |; G9 T. @ s( ~ O5 H
: R, [7 W, D, v& u( pvar copyspeed=marqueespeed' S. P a- [9 _2 L; U$ t
var pausespeed=(pauseit==0)? copyspeed: 0$ ]& E$ I3 c& V+ d5 O
var iedom=document.all||document.getElementById
' X) h% p w( j2 J7 q8 n o+ t3 lif (iedom)
, W3 d- N6 w; f* \% z8 sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 q( b- M) K+ s- Evar actualwidth=''# p! Z: L9 T: ]( u) J
var cross_marquee, ns_marquee
- u$ K. A4 C: p. U9 P) p: P( c
& w8 `5 n* L |* }& Lfunction populate(){( k2 a3 u7 k. C9 H2 f# D1 ^
if (iedom){
0 V- S5 y$ q, R$ i! `9 ?- u! _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( ~0 ]9 _ W5 \: B: U% w
cross_marquee.style.left=marqueewidth+8
1 z3 k3 g4 A: {0 Xcross_marquee.innerHTML=marqueecontent2 K2 [# x' B2 ?0 @# d0 J. |# Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. z* V- n' y% J/ ]) m
}
2 i; R! D b+ ]6 V% z( ^else if (document.layers){
( k, c9 M, u$ B& p' dns_marquee=document.ns_marquee.document.ns_marquee28 H6 _8 X, [5 v# n, w( n" t8 ^& ]
ns_marquee.left=marqueewidth+8* D* p% ] W# F( _! z- H( h! n. O
ns_marquee.document.write(marqueecontent)
8 }7 d) X n4 Ens_marquee.document.close()
; a0 ]( i" D: e2 H2 l1 Hactualwidth=ns_marquee.document.width
8 F+ v0 T6 X/ a7 ]! j1 e3 S2 Q}9 b7 ^7 o. |$ ~: K7 r
lefttime=setInterval("scrollmarquee()",20)
9 a6 X7 `, ]& w4 y) ?# W}
, c; X6 g6 ~0 ^( Y' \0 m* uwindow.onload=populate9 j! k& N4 @; T& X
. a" n5 |1 e7 l! b7 dfunction scrollmarquee(){ ?' i. b) I& a
if (iedom){3 Y, `! Q4 N* A7 \8 K- R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( F. G& |$ p* H, x- scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. {3 ^( K. g E8 w
else
0 q$ V* W8 ?" `& [+ O9 |cross_marquee.style.left=marqueewidth+8
& x1 Q' k& ^# R5 G8 _. b) T3 l, E4 }' G* [& X" k
}9 a1 O3 C7 y( H& h3 i/ L* N
else if (document.layers){
; U: }. e5 w- E4 y+ V( M0 ~, gif (ns_marquee.left>(actualwidth*(-1)+8))
6 O. G9 [2 S8 t5 G" P6 [" ?6 Ins_marquee.left-=copyspeed* B" a' B" w0 A; R# r6 n
else! C4 e( i1 U" e- g0 T' d! G8 l
ns_marquee.left=marqueewidth+8
& p/ F0 u$ f. J u: B}
& \! A% }7 }$ ]- ?6 m7 ?7 z}% f2 \) v! H6 ]
2 c8 z1 P9 d# ]" ]
if (iedom||document.layers){7 G7 D# Q1 `( j" E) C
with (document){
) F& U- x, r, U+ |: wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ K- P0 S; H% Gif (iedom){
6 D- a, b- E6 D& Z+ G2 F0 f9 H) |$ Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 [" |5 t5 l* g) t4 wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& _. D% o( s4 ?* z( |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# K; h: u+ P. B' ~' o9 Y3 r4 C
write('</div>')4 U+ |4 t. h" a- z
}" V$ W }, D- l4 B. I/ Y0 }1 l0 Z
else if (document.layers){; r, K2 S) g2 G" h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- W8 V3 x: c) ~3 E" d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 V0 j7 U4 _" n; w9 x
write('</ilayer>')
' x* Z8 d; o" |7 s9 i+ ?# R}4 S" P; u! l2 F/ U! U
document.write('</td></table>')4 W( {5 A+ F7 G. w# o1 s
}2 O* p* Q5 d( @, u$ S; f8 U
}
5 _7 o7 X$ i8 U3 s+ Q* @</script> |
|