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

|
网页之跑马灯文字特效
//修改宽度
( R! i0 S) S$ a" G/ i! z6 R, S1 Hvar marqueewidth=300
$ V3 w3 K# g( [/ r//高度
9 s* n0 ?. N3 M# d- {var marqueeheight=25
; A; E2 t t/ Z: m2 n//速度(1-10)
9 W. K( I3 w& { gvar marqueespeed=3
* F& W6 l6 l7 W5 m& Q" G3 W//背景颜色
f! C! f! k1 t; S# W, Svar marqueebgcolor="#FFFFFF"
- u" P" M- P* U0 e. u+ C9 ~9 C//是否能暂停 (0=no. 1=yes)?3 [, c: G7 M& L' G. o
var pauseit=1
/ h* \/ G4 Q4 q9 E3 g2 N, S+ ~: T6 L2 z( M9 L& ]
//修改显示内容# Y: A* b8 j1 W- K& U0 I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ H% U7 e$ u/ @# E8 {6 R. k% q, g
0 r' I. R B* f P6 |0 H3 ~( j, m
1 N2 I) v- o* E4 U u////下面不需改变////////////
/ d+ Y) [" o, f0 V6 I1 ^( j) V, C: t; T+ w W% J
var copyspeed=marqueespeed
+ n( H, c9 H) Vvar pausespeed=(pauseit==0)? copyspeed: 0
2 H4 u- Z9 F( T2 fvar iedom=document.all||document.getElementById( B4 n u. Z, _7 \7 X
if (iedom)
) z1 ^0 k2 `( r/ Z% adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 j# ?0 ~* B8 _$ z$ v% z
var actualwidth=''
9 b ]5 J) C) ?: Z5 {- u) V) Qvar cross_marquee, ns_marquee
: Y6 f2 ^5 ^9 _; ^: @$ y8 |: j* D7 P: D
; m/ q7 @) [- E4 efunction populate(){
; x% j }5 n1 t2 V, A( ]* |0 }if (iedom){/ N6 Z- v! V9 J+ k* D" n, @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 S Y, [& E* h) z0 r; K |& Wcross_marquee.style.left=marqueewidth+8+ q( S: a" F8 P7 i' {
cross_marquee.innerHTML=marqueecontent
; o i) _& j% [% T6 \- v' I) f, I; Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- ?8 }. O$ E! A4 @3 M}
. m% } Y# K- I/ ~/ i+ ielse if (document.layers){
E& w \; d4 ^; q& e* q7 [ns_marquee=document.ns_marquee.document.ns_marquee28 H% u, I. Z5 Z
ns_marquee.left=marqueewidth+8
% r2 X% e5 f5 \% g6 m: jns_marquee.document.write(marqueecontent)& J5 I6 P+ Z$ X! F% l
ns_marquee.document.close()
" ]) ?' U% t/ l0 W0 V2 U- i! {actualwidth=ns_marquee.document.width
]* m& M6 Q1 v+ S4 ~- w}" L$ `2 m7 e( s0 b
lefttime=setInterval("scrollmarquee()",20)# `, z( i7 g5 S/ C5 _9 h; F2 S
}
% T% R! c% @' W. {: Dwindow.onload=populate
# K3 h! q8 u( v6 P4 [
7 j% W: Y' R1 gfunction scrollmarquee(){; B1 n6 p3 [; y+ A3 a* c
if (iedom){
6 Q9 L; a, K) `- aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* \: ^/ @+ u" u0 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 g+ I" l- x; W( m/ w# m! belse
& [3 h1 z8 V( X2 U) N4 xcross_marquee.style.left=marqueewidth+8
# a3 p( u" k: ]+ I/ P; H& Q
7 s e! k+ E- n0 `/ d' C* m}
* y5 g+ |1 i8 ?, V) A( _else if (document.layers){; L( F9 m+ V/ p; b# X0 p
if (ns_marquee.left>(actualwidth*(-1)+8)) O! j0 ~6 V5 s
ns_marquee.left-=copyspeed
4 T6 t3 x$ K, `6 R& G# \' K6 O& m3 x9 ?; Eelse) {) N4 F* f+ X( ~1 v6 G
ns_marquee.left=marqueewidth+8
& k& j6 T: a6 S! U7 f& c}6 Z1 d9 Q! N! h9 Q1 ^
}
* f, Y4 Y* T& G7 V
, ?1 a I1 R* R1 D, Sif (iedom||document.layers){
4 y% ^) c% a5 d+ v {with (document){
P3 T8 p2 A& O2 B% Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* u- J) O7 u D! d
if (iedom){
( j1 F; k* H, D0 j. vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 j0 ^6 J$ g+ H. M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- L* }0 I1 c. @! N! W7 m. E/ Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 {) ^1 V, \7 V1 B8 B1 r6 b2 H% n
write('</div>'): @: H: A' j5 p
}
$ k, ^! o+ P) T8 r3 w/ Aelse if (document.layers){
2 |9 R/ X; v0 @& t+ I' S. lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 {9 x: t: n, q! q, Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 m# J$ r7 U9 Z% }# l; J4 e. ~write('</ilayer>')
! y1 {- a8 u# E$ b% g8 \}
$ H, J* D- K/ S# rdocument.write('</td></table>')$ J- {) I7 s q! v& h9 l
}* d$ |( J9 Z1 m/ j
}6 Y3 j1 H$ ?3 z# G9 I' I; s
</script> |
|