返回列表 发帖

网页之跑马灯文字特效

//修改宽度- t! P& t0 \* U
var marqueewidth=300
  T( ^6 C4 Y# p2 U//高度
/ A; y4 g6 Y5 B) T) pvar marqueeheight=25
+ T1 V9 d; x0 u# b: \8 N# H7 P3 w//速度(1-10)5 k5 D  m: \. o, l
var marqueespeed=31 i* s# S8 V$ S; C6 d! K; O2 y! d
//背景颜色) b1 N9 }0 J# p- f) X+ u
var marqueebgcolor="#FFFFFF"
" T% @9 N5 M* S; B% J0 W//是否能暂停 (0=no. 1=yes)?" }  z9 i7 v: j' U) \6 a  [
var pauseit=1
& f: C8 e# q, H  P6 o  ?! D" b' U- U* f. w. L/ m8 r
//修改显示内容
5 \3 x" T; h9 ~- F8 I' ]# `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': ?# Y8 q2 s* s
1 r- t3 H, {4 P4 O: c0 Y2 }3 K  j
; _3 Q- A7 V* \
////下面不需改变////////////: ?( s, b& s" x: m' a- ^

% a" B" L/ j) g, ^/ mvar copyspeed=marqueespeed
: K. m( N* ~. P: G! Qvar pausespeed=(pauseit==0)? copyspeed: 0
' O& L0 \  D7 Tvar iedom=document.all||document.getElementById8 }+ h6 |" x& o8 W
if (iedom)
7 k% y6 A+ E1 L. S" H4 t! Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 l+ }! B5 k9 d* ]9 [* O
var actualwidth=''
3 p. G$ G2 g0 S. j6 d4 x; _! Bvar cross_marquee, ns_marquee
' n4 ^- f1 \6 ^
8 J! b) v3 s4 W3 v; R+ J1 Yfunction populate(){2 D. B. H$ R8 ~7 p! J0 ^! t
if (iedom){
& |7 [' l5 ?) Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  z6 w. t4 ^' U' D
cross_marquee.style.left=marqueewidth+8
# h0 e7 y6 C1 G7 O. b% g" i* Bcross_marquee.innerHTML=marqueecontent
' h0 V+ r/ u3 `6 T) zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& l) f, _* r* g3 e$ p}* F9 G) f0 v8 e6 \
else if (document.layers){
- w  A/ G1 q8 X' h' v* I: I/ z& }ns_marquee=document.ns_marquee.document.ns_marquee2; E% }4 {9 ?' g; R% V
ns_marquee.left=marqueewidth+8& L* ]" D) S5 _3 h
ns_marquee.document.write(marqueecontent)
' ^4 t0 h8 e* @! [$ e+ ?0 Mns_marquee.document.close()
. N# {) n: V: q! lactualwidth=ns_marquee.document.width, v% s/ e& P+ d4 d* t
}
5 `8 F) q& G( B: Olefttime=setInterval("scrollmarquee()",20)
- m( d- G/ l  x# p% b8 z}, K. p8 s- o3 f6 e! b
window.onload=populate
5 k( t3 u" o7 h7 i' f5 g7 `% w& l, x1 W" D  w8 N# x4 Z
function scrollmarquee(){
# |7 o! d9 ^8 h& Qif (iedom){& `5 C6 X. x+ I. i8 P2 R- a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# m+ v: q, j8 P( ~6 r+ F3 z" Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: k  y, }( d' g4 S* Q! y6 K
else
$ R" Z8 w$ _! u+ ?cross_marquee.style.left=marqueewidth+88 n( ?& f( a" a/ l

5 T7 `4 Q- k; o/ h: l% e}& a# `1 F; i# `; }
else if (document.layers){
1 J1 p& K! T8 C* ^7 l5 B% r% Y) }if (ns_marquee.left>(actualwidth*(-1)+8))( q% H; O' o7 q
ns_marquee.left-=copyspeed3 X6 k5 A5 e; H2 O& n2 U
else# V( S4 T' z+ `
ns_marquee.left=marqueewidth+8
: K  R) [* {  a2 ~}
$ S7 W3 E  ?7 f; [4 \* a}6 q1 o* W7 D  Z  V, J/ C
9 D/ `0 p( q  D6 {: x: m, b% i9 r
if (iedom||document.layers){
, Q9 v, }. K+ }0 R6 Y/ O' X2 L. Ewith (document){# K3 P% B0 o6 T2 S, m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& Y; a& b8 Z1 y7 hif (iedom){
) G2 z8 V% ^2 A; ?; D  Y( K' ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  U3 ^; P/ I+ P# N3 D0 O4 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  U8 ^8 A4 Q3 r" hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! n# d4 Y( L7 v6 V: ]
write('</div>')
. h5 G$ H/ b+ j$ r& p+ {}
+ c. E" A& P) }: l1 Telse if (document.layers){
( K  b6 N/ G; Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* w/ @2 X: e& y; Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* h- J" y( P5 F. b3 h7 ~
write('</ilayer>')
$ `# A5 i, t0 P, G}" ^* b; O) c3 @7 E5 G
document.write('</td></table>')
/ F: T' D$ ]( \& a  e}+ C; x$ H2 i. ]
}3 y! g; r; K4 M6 H9 G* i2 t8 n
</script>

返回列表
【捌玖网络】已经运行: