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

|
网页之跑马灯文字特效
//修改宽度
/ @9 L0 v" J' Xvar marqueewidth=300
/ y9 A- \* V1 e& ?' n' j7 P//高度
( j7 B6 {3 C$ y! T6 Wvar marqueeheight=25
( p9 `' V8 A, _" O c//速度(1-10)0 L4 q9 d9 d/ a# z
var marqueespeed=3
4 p" j# C* P Y$ Z$ n- `//背景颜色
1 H9 ~8 F, ~. O6 V' x8 Ivar marqueebgcolor="#FFFFFF"
' V ]( Q: g8 F; X* W. H/ M//是否能暂停 (0=no. 1=yes)?
' U+ I2 Z1 O0 v6 z* lvar pauseit=1
6 ]5 w0 u! p+ l5 s1 x% ^- D- C) r' K8 u' j. y, P- C3 L
//修改显示内容
& o8 L0 Z% C; Z: v5 b4 ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% E: \4 p: s1 U, ]5 S" n- G% M! t+ Z0 p( P- a: N$ \
( F' |& D* {, U" i. N* l& x////下面不需改变////////////
) `$ e$ ]3 F% v M# O% R. w3 J: I8 z( U7 f6 v* j+ k
var copyspeed=marqueespeed) t j8 m& ?0 S A, X9 M. z
var pausespeed=(pauseit==0)? copyspeed: 0' X: b) d ?( _( l4 `
var iedom=document.all||document.getElementById
0 }% `0 P& n9 Q$ j- G$ @9 `if (iedom)
% O& x, f$ ^/ \& Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 i& \2 _/ U- T
var actualwidth=''
, g2 v" r1 E) a9 cvar cross_marquee, ns_marquee" ^. O( O; g. l) n% x) K" V( X2 x
- Y" V2 N( _0 b! b7 Kfunction populate(){
( o& o- q) l# @ D6 H$ Aif (iedom){
3 W! d) }1 q+ C7 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ R: n2 k+ f2 a bcross_marquee.style.left=marqueewidth+8
% K- u& b4 b6 w) Pcross_marquee.innerHTML=marqueecontent
% w: x6 f8 a, U2 h5 P6 p& H& ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. V& z( U' i. U8 V R* w" Z; Y
}
7 Z9 a3 O8 A+ @, Gelse if (document.layers){# j6 U4 w( }! S4 K. ?4 G* p
ns_marquee=document.ns_marquee.document.ns_marquee25 Y' o9 P! W, x" f5 r( g
ns_marquee.left=marqueewidth+8
' u1 A' `7 a9 Z5 U) J9 Jns_marquee.document.write(marqueecontent) w- s& M0 I( q4 O' ]
ns_marquee.document.close()
6 h- U, y- ~7 d3 M5 s8 y3 Bactualwidth=ns_marquee.document.width
" E1 X% I1 C( j9 u# S( N4 l8 L}
% p5 r$ m2 z& y8 M* vlefttime=setInterval("scrollmarquee()",20)
; R% f% V. ?' V& w}: q/ F/ P! ~9 Y* a- q
window.onload=populate
9 N) Y1 k- _5 M, v9 E& g4 F; @8 i; c, ~5 A- w) s* i
function scrollmarquee(){
+ D5 t8 Z9 t' S6 I$ S6 yif (iedom){
6 h8 L3 q# D9 B. sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: ]2 r# M* ^# ^+ P8 Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 F8 V3 f) p8 R; v/ a/ X4 d# `else
7 i3 L6 N0 {( Y/ ~0 ]* e, r6 {# mcross_marquee.style.left=marqueewidth+83 z1 b) p9 g$ S
! n8 u1 S7 T. l$ h* @, v3 |
}
2 R" D/ G( r: k$ |1 @# ^else if (document.layers){
R Z- i8 G Y6 K% mif (ns_marquee.left>(actualwidth*(-1)+8))
" W/ X \% z# C( }+ P" v4 ^ns_marquee.left-=copyspeed
q0 Y# p( { t. [8 R! t6 V" Xelse
4 \1 `7 C$ G8 o: Cns_marquee.left=marqueewidth+8% _: p; }2 D j, R9 |! H
}4 I. Y" N4 t% }: b8 T4 S
}' K! v5 \$ ]+ y
3 Z$ X4 @6 U! t* o) W; x* tif (iedom||document.layers){
# G! A" ~0 B4 ], p* {; \with (document){' p2 u0 n6 g, Y( Z+ s" V4 S1 ~) v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# d* p {" u$ B- u: h5 ]
if (iedom){
1 o% {+ v( Q# `" p1 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 x' M+ _" J Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" `3 n9 C) [6 b! z& U. M- K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- }7 m5 i( S- p3 r4 c- Y$ `
write('</div>')0 ~+ O3 x9 E9 i0 ?& p. ?! A
}
# ~1 g+ f2 B% T0 u# |else if (document.layers){9 e: m! a+ ]# u2 f3 j0 @1 r& @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ A' D K4 x7 v, l8 Z0 x) zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! j2 b/ u' d' p: k# ^write('</ilayer>'): G6 M3 e) K s9 n
}
$ k" B" @! V) G. z4 T x( O6 V8 bdocument.write('</td></table>')- w4 ]( ^3 m! a T; O" r& n
}
$ |$ v3 y7 N3 |) j}3 P! _5 j) M/ u+ B4 j5 o
</script> |
|