返回列表 发帖

网页之跑马灯文字特效

//修改宽度) \; I! z' v- }4 N
var marqueewidth=300
( O( P2 y+ c. K/ x+ Y//高度
' ~% J1 @+ Q. F% l" _var marqueeheight=25
6 j* }' ~/ [% G" O% ^' t//速度(1-10), [/ X3 C9 \  q* A4 o
var marqueespeed=3. [! q2 L; H. j* x# q7 G
//背景颜色$ b1 K$ c4 K: _. `; X0 l1 a( ~
var marqueebgcolor="#FFFFFF"/ H; H- |) ~: j7 A  O) D8 ?. P
//是否能暂停 (0=no. 1=yes)?
+ d; |3 ?) g4 d" F/ I* Xvar pauseit=1, Y0 d& d8 Z% W

+ i& z& L; Q2 h* v//修改显示内容
: B  G% f" s- T0 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 Y9 G" L9 X8 s& e+ \! {6 t& `  Y
7 i3 Y! {/ m( h9 m+ x# D# W/ b3 _+ v$ @2 z
////下面不需改变////////////$ i4 S5 C3 |- ^7 b8 w% v; i! R" Q  r

% V1 l. a# u' r) p/ d: g$ Bvar copyspeed=marqueespeed
% t3 H' V% e) N9 m8 I* V$ m- @var pausespeed=(pauseit==0)? copyspeed: 0
3 A, c; j6 K2 }5 M$ x. Dvar iedom=document.all||document.getElementById& ]& ~8 [2 I2 ]9 [; u- {: V: ?4 r
if (iedom)7 C" E% d' Q" u4 F, G3 b% d- P4 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ s) c8 {' [9 c4 mvar actualwidth=''9 c) R& n; ^$ ?4 c
var cross_marquee, ns_marquee
0 X! B! v& y' P- O& t
1 a8 j* h; k0 L" l; @3 rfunction populate(){0 @7 b5 Z: ^- G, Y, }
if (iedom){& \7 t' [; j- o' _: r2 |" n6 d( D: }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: Z* b8 `: A$ ~# r2 U, S9 ?$ ccross_marquee.style.left=marqueewidth+87 ~6 w  @! W: G0 B
cross_marquee.innerHTML=marqueecontent
( U' _3 M) b! Z9 g$ u$ h$ ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* c# H/ H8 E' r# I* K
}
- s' @  b( S) H5 W; @! g; H5 V) Celse if (document.layers){& p" n0 n. T4 W5 t+ @7 R5 W0 h
ns_marquee=document.ns_marquee.document.ns_marquee2
6 |9 M, g* W7 @" Vns_marquee.left=marqueewidth+8
; \5 F7 C2 k( F+ ?; X1 v3 A9 g$ lns_marquee.document.write(marqueecontent)9 V% N; G$ g- e) E+ R
ns_marquee.document.close()
; e. R: \0 `8 f/ J0 n; Oactualwidth=ns_marquee.document.width! L0 y: W+ m- |4 ~2 A
}/ E1 D" H! n* n5 e9 Z
lefttime=setInterval("scrollmarquee()",20)3 C- ?3 Z3 g: X3 ^$ O5 K; V& M
}- n! H) h8 n+ ?
window.onload=populate
6 K  [  I; A, q. W) X, D; K$ A; l9 f; f! ~7 k9 Y
function scrollmarquee(){
4 {% {7 J( Y, h% n. `6 }& qif (iedom){: ]7 F. G9 {% N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 A) o8 u7 s1 m' g) `$ X4 b2 n% Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% _- g! m0 |3 C7 E4 @
else  U: R& @1 v7 I7 I* ]. I2 [
cross_marquee.style.left=marqueewidth+8
) [  j% G- ]/ C/ G5 G- U
& g: U7 Q( G$ e7 ]}5 ]6 t8 {$ {1 y
else if (document.layers){7 k/ M% Q2 |2 z; f/ l0 G6 }
if (ns_marquee.left>(actualwidth*(-1)+8))
' R. X9 W3 F7 [ns_marquee.left-=copyspeed# q5 X- U) f! Q! R0 Z' e
else
; o. a( f  ]8 o* x) w3 F7 vns_marquee.left=marqueewidth+8
' ^3 i$ h0 ]9 q4 a1 S2 Z1 A}
. h$ V1 D* D% q+ P}
8 w- b7 ~! Q  A" O$ L3 E+ R( \" S! H  N; `* H+ ~9 o
if (iedom||document.layers){/ r" b# o6 o& }# q* G
with (document){4 {% Y- U% K$ _0 m$ R$ U' b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ s" {2 b. d3 ]  U$ K& }if (iedom){
, F% i* P. c: m& H8 a2 qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# s; V/ U( W! R% ]: T! X% {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 O" l+ [7 Y4 j5 ^9 A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ L8 \& U0 |% e" ]& e7 g, F& v0 j4 F; J' `write('</div>')
2 d% A* Q- h& K+ ]& i, I' p/ j}/ M" D+ B% V1 L( h5 s& ]2 _
else if (document.layers){" k4 n7 `! ~8 s4 _1 n; b6 Z/ q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  A/ t7 N! I# C+ \: {" b7 iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* D5 ?, ?3 d' Y% ?0 J
write('</ilayer>')9 q2 y4 {6 c0 @0 ]$ Q6 S
}) b! n5 `- @' L' p6 m0 s
document.write('</td></table>')% a/ P1 p0 M9 f) p% t
}
! g! G) j' h& C# a; R4 H, z0 T  ^}5 @4 v6 n( r  X' p) B- {5 `9 I/ x4 x
</script>

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