返回列表 发帖

网页之跑马灯文字特效

//修改宽度( u" V; ^0 X, t1 G
var marqueewidth=300
4 B3 h) ~; D0 `7 h' y//高度0 n5 l. Y# O) B5 O/ \
var marqueeheight=255 R) U5 L  H. E/ Z
//速度(1-10), _! x4 [! s8 o- s; _
var marqueespeed=3
4 p2 j; p6 i  B7 I//背景颜色
, \. ^6 k: h9 y/ ovar marqueebgcolor="#FFFFFF"
) c) _, ?* A. A1 D' q* u$ w) k//是否能暂停 (0=no. 1=yes)?+ ?' P! q$ C( o  Y- T( C- X
var pauseit=1, T6 u& N& l8 d* o" q

! W. c- X8 B) p0 Q//修改显示内容3 X3 I- V0 O% ?/ O9 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 y7 b5 _3 m% l0 v' h/ r4 F: d- R1 @( K5 k" R) K
; F7 p/ T0 Q. }0 H: y1 h
////下面不需改变////////////* f; c, J0 z+ t4 T6 s# H

" o) s; i0 y/ m4 Svar copyspeed=marqueespeed1 g% {1 ^: z0 X
var pausespeed=(pauseit==0)? copyspeed: 0
% J3 B  U3 t- }# Y, Qvar iedom=document.all||document.getElementById& |; U. j( X: Z1 g+ n
if (iedom)
2 |' d: @6 I7 J$ q9 ?; J# ?$ fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. h) e3 P5 ~/ Q2 A8 c! Evar actualwidth=''
0 r+ q2 v8 f+ ovar cross_marquee, ns_marquee
+ W/ f( U/ U5 d  Z( {$ l; v: V4 J7 ~; c1 [( J
function populate(){
  W& y* T% H5 K1 H7 }/ O1 zif (iedom){6 d  @7 A* A7 I# H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ |* @( Q2 H/ V  n0 Qcross_marquee.style.left=marqueewidth+88 x, A3 g$ V" d0 R. N- v1 y+ o6 v
cross_marquee.innerHTML=marqueecontent
7 O7 F. d0 a2 U: Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) C# Y" W( ?7 g* {5 L0 `  G% U}0 |8 m& T) [( n, @9 h0 `2 q
else if (document.layers){
1 {+ g/ j  i8 F/ ^% V4 J% Vns_marquee=document.ns_marquee.document.ns_marquee2
) d5 ~) \, L, x6 f8 [8 Ins_marquee.left=marqueewidth+8
3 m$ V6 e9 \: E& ~. Qns_marquee.document.write(marqueecontent)
. |1 @% D- s1 s$ k; @: Qns_marquee.document.close()
, h9 y, \4 M, T( n+ m: _' vactualwidth=ns_marquee.document.width
$ V. `- }& L6 d! x3 l& z/ w- \}. I% u7 c, n& s2 Z1 w! I
lefttime=setInterval("scrollmarquee()",20)  F( s. B% ?+ G. q1 I1 [+ M
}  i+ O; \& L1 j' _5 p, ~3 L' V* A
window.onload=populate- _$ R: s/ G% r( Q9 P, B

% l* ?- t  n$ Y9 i; D9 |2 {% dfunction scrollmarquee(){
6 j) ]5 U1 }2 [7 E5 Bif (iedom){
, c0 ?% P& L6 b7 d5 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 H! ^0 Z, E/ `6 u' n; W# ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 L2 k' v4 X; o2 G6 felse
0 p( y: S7 W, j, G; f( j6 d+ o! Gcross_marquee.style.left=marqueewidth+8
# ?% t! @) p4 A3 Q; n/ v" m) N. Y0 \4 Y9 h
}2 ^; |+ g" o1 n2 I) z
else if (document.layers){
: p& ]6 l' g( m( A! Xif (ns_marquee.left>(actualwidth*(-1)+8))7 W# E; X  ^* C/ Z- }8 H1 t
ns_marquee.left-=copyspeed/ v, D0 R- U' I' [6 R9 I0 Q# \* G
else  }0 j. I; j2 Q( ?. E, a' V
ns_marquee.left=marqueewidth+8
3 L4 o1 `  n6 Q, }}
7 P8 W% B, L; l# Q}
/ t: B: L2 W" v
" Q. I/ N  x& C0 _if (iedom||document.layers){, s' @" M. F, h
with (document){
* l& i. ~+ H' C3 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), X# {( T$ {! z& V9 i' \
if (iedom){4 t$ Z; C6 J: L9 m2 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 _* a0 a9 L( ?7 V4 L8 y  u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: ~7 K* F2 C$ m+ |! n% wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. I2 K9 \1 S- Zwrite('</div>')' a  h9 w7 p, }$ K, H
}
3 N2 l( u  z  q/ T+ T, l9 n- Yelse if (document.layers){' b! U3 T; A: }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; w' T' r4 k7 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* x  s1 O6 u! j0 Gwrite('</ilayer>')( ^# r" Q! Z" A1 s
}
4 x# z( H. Y+ k* V5 {0 z% s# [- zdocument.write('</td></table>')" X. f4 x5 h7 U! }' o5 V
}
  Q! R9 H( y) G4 B$ c. ]}. D, `+ a, H% W0 D
</script>

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