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

|
网页之跑马灯文字特效
//修改宽度
6 x* C+ E6 i6 J: c0 L, C) uvar marqueewidth=300
/ Y G. o# J' Y//高度
( B% L' c% U: B0 m; [var marqueeheight=25
( M9 E( v0 ]. S l//速度(1-10)9 d6 h- `: a2 [! c2 E# Z% }
var marqueespeed=35 t( y1 R( g5 W) }4 r4 G4 y
//背景颜色/ r0 _2 f S+ r3 ~: F
var marqueebgcolor="#FFFFFF"# M9 _9 X \- W! h3 K- e
//是否能暂停 (0=no. 1=yes)?( t! E- c4 Q- r+ j/ ^
var pauseit=1
- H5 L. n" H9 |6 g9 C9 L) G: [
1 _; @/ a) r3 j0 R//修改显示内容9 w5 l% L7 T; O& @7 q+ Z* B6 e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- a; P% A3 K6 z* [& t6 t
! H" c( W! Z. Q0 A2 n# i/ k/ l; x' J v$ e, l
////下面不需改变////////////$ o* S9 I9 k8 z* x ?3 { }! U* Z4 r
( l$ A+ c2 c+ N2 M1 f0 n
var copyspeed=marqueespeed
5 x9 |# y E5 Gvar pausespeed=(pauseit==0)? copyspeed: 0
1 ~; g3 b6 b* t/ p. k& V9 ~5 fvar iedom=document.all||document.getElementById% e# u3 b. {4 ]/ M. R
if (iedom)
7 V' i0 A4 |- a3 {$ Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# M; ?8 B1 V4 {var actualwidth=''
% c" x( S, x7 k+ e4 }var cross_marquee, ns_marquee
2 C7 z D g8 E7 Z1 N
! ^( O5 B- @" U# \8 kfunction populate(){
7 W9 h, r: q$ ^: |if (iedom){
: r$ o6 a3 V7 E r5 ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 p3 x0 y0 Q: Q7 n
cross_marquee.style.left=marqueewidth+8
7 t! x6 D% k7 |6 X Z9 G0 A4 Q3 S: vcross_marquee.innerHTML=marqueecontent
[+ L* X1 A. Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( C5 ?* ~. V) r9 y3 X5 F
}
: G, H% I1 @. V1 ?1 Telse if (document.layers){
- N' b! `5 b& a+ U2 ons_marquee=document.ns_marquee.document.ns_marquee2
2 j4 p* Y4 f( m4 O' n. wns_marquee.left=marqueewidth+8
/ z' W* q8 I9 G- J7 Cns_marquee.document.write(marqueecontent) ~9 \9 j3 w |5 Q9 ?1 J' N
ns_marquee.document.close()
! \- U5 {# a. o \ Uactualwidth=ns_marquee.document.width6 `% x4 V5 c& n% f$ I
} g1 W$ a' o: B+ D$ m: i7 f, q: L
lefttime=setInterval("scrollmarquee()",20)& X+ L+ M) `0 a
}# s: l4 X. J0 y5 L4 z( Q3 p E7 b
window.onload=populate4 j1 a) D" R+ z$ ?9 v, n
* \7 o* c3 a8 r" ~7 zfunction scrollmarquee(){
% `1 F1 n& P' O! [3 K0 K: t0 d* cif (iedom){
, ^9 y$ d# L% E5 K1 y2 \/ xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ f& E0 ^# K3 G& v( b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) d, v) a7 g- q# M6 b7 t2 velse/ ~0 z0 E% A* i0 m' Y: C. ^
cross_marquee.style.left=marqueewidth+8
3 c% U8 c9 J; O5 B4 }. M0 C2 F( C5 F$ Z% B6 m8 r, N0 |
}9 W' U+ V; m9 w9 y5 y$ c
else if (document.layers){
: o4 v& M* c0 d9 C" h9 j: mif (ns_marquee.left>(actualwidth*(-1)+8))6 d4 o7 J% c4 N: e4 A7 E
ns_marquee.left-=copyspeed
4 [" e- k- L) _* c, U8 q; e/ g: @else
6 E- m/ F( ~5 Z+ mns_marquee.left=marqueewidth+8
; M% T! W9 R" P, K4 C}3 f v6 S7 J" A+ I9 Z D
}7 g3 p" u/ D# B1 a2 G
# K* U+ x; h2 M0 Dif (iedom||document.layers){
b" _/ ^, v5 U; F4 C. k1 jwith (document){$ G$ j+ H4 ]" [. ]& D* h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, K+ k4 B5 _4 G# J- F* E- Yif (iedom){2 Q/ t$ W. N* a. Y& v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 G* r3 g1 I/ a: N' r1 b/ C3 `9 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 F1 d M( \9 {+ owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( L+ K3 ?2 @. o7 Z7 |+ |. q
write('</div>')
$ j- Y7 @3 `9 X}4 W. J1 h! t( B; ?" F8 Q
else if (document.layers){
# X7 E) u; p' _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 ~" C3 v2 H8 v- P* U2 c6 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); Q0 P0 _4 }- n
write('</ilayer>')3 \6 l$ S. u3 o1 j5 F, ]
}
+ x" P: [' `# x1 \4 Tdocument.write('</td></table>')
' J, [+ _5 v3 M' |4 z6 y% j3 a} n6 e$ T% m$ F6 Q5 S2 r& }8 L
}
$ R% n" C$ y X# l: z- S</script> |
|