返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ M# W) a2 C& B' V% A: ?
var marqueewidth=300
- o/ J8 _  N8 C6 b# Z# j; U" l6 _  g//高度6 l0 C, [+ N( q* P8 G
var marqueeheight=25# ?4 |& x- Z; t% J
//速度(1-10)
, l! p+ _. u! Z( O+ gvar marqueespeed=3" H. k) @/ Q9 r0 o
//背景颜色' A! R: n$ w' x4 C9 d* b# w& Y1 H; a1 a( M
var marqueebgcolor="#FFFFFF"  @/ P- Q5 n$ P/ A0 |- H; g
//是否能暂停 (0=no. 1=yes)?; _5 K  N4 u1 A$ F5 P' h
var pauseit=13 Z8 ?8 w# ~  Z( A; Z; c

) Z$ E3 C* M5 K& o9 s1 F//修改显示内容+ a6 V8 q+ }, i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  o/ E" b+ J2 Y" A
/ w/ P8 H* J3 M+ M* Q+ @  F0 _! f2 l% C
////下面不需改变////////////1 L" Y7 e+ G, H# \4 x# P6 z1 D

/ U# k( E+ b3 h2 s7 z6 h+ d- Wvar copyspeed=marqueespeed* _: N3 q9 \0 y
var pausespeed=(pauseit==0)? copyspeed: 0$ A7 m) r; U* n
var iedom=document.all||document.getElementById" e0 D; G1 }; W% M8 h  T1 X
if (iedom)
2 H( I4 }- t" ?* k9 j  r" z7 e0 |. x. zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 ]. M7 p+ M0 k
var actualwidth=''
+ c* X) \, V: z2 U1 Q: R, dvar cross_marquee, ns_marquee+ y6 W. ^' }2 }8 V6 W

/ S9 B  f: ~% f) s9 o& A; Afunction populate(){* q1 g! f3 }$ j. U3 _
if (iedom){$ x# o; d# g6 q' i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 V$ ?/ |. V0 h  vcross_marquee.style.left=marqueewidth+8
! }( y1 t; j3 O  x7 x3 ycross_marquee.innerHTML=marqueecontent
- q$ ~2 Y9 c* o" e% uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) v  n5 Y" v* z}
- I3 f# R1 F' S% w+ yelse if (document.layers){% h" Y  K7 z% i
ns_marquee=document.ns_marquee.document.ns_marquee2  u+ g9 {5 K" a8 _
ns_marquee.left=marqueewidth+8
( u* d2 }* M" o* i! M- m  Wns_marquee.document.write(marqueecontent)
, v' V7 F6 M4 Xns_marquee.document.close()/ A- J; C. i. g0 H% B6 N
actualwidth=ns_marquee.document.width0 a) u% F0 P7 a- a' y
}
: t$ |' a4 W( R1 h2 Plefttime=setInterval("scrollmarquee()",20)
/ ^% \3 Q& @9 }9 d; v) T* I* n4 S}
0 Q' w- o. \! A6 Rwindow.onload=populate/ K) z. ], L! @2 M! T
* u1 i' h/ H- E. e; j3 N
function scrollmarquee(){
! r8 x6 v* a3 I5 l: qif (iedom){& v' ~* \% P4 l* a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) A' ]2 h2 h7 d* z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. z/ j. V; U2 ^& ^6 r+ e7 t
else8 ]9 y8 }* E# ?6 X5 _. M) n
cross_marquee.style.left=marqueewidth+86 V+ H: l6 ?# v' t8 d# q$ s0 t6 `4 S

" E" K6 {/ [) M( K, N2 g8 u}3 U" z( `3 c3 Y. d, Q3 q
else if (document.layers){
% [" K( t9 v- N7 Z, j4 q. O  nif (ns_marquee.left>(actualwidth*(-1)+8))  p2 w4 K! u( A- k. U
ns_marquee.left-=copyspeed
: ^" ^3 ~5 E/ m  p7 p1 Delse2 U$ P. s* e& l6 j. k& ]& u
ns_marquee.left=marqueewidth+8' c- W5 _; s5 p, H$ s* R
}
/ _- S6 Z6 w; V6 X4 a; j: Y}& F  {3 K0 g+ B" O
: F" E1 p+ ?; x* `% v% d, q
if (iedom||document.layers){
. T* d- t5 u7 \, K) {2 l& O5 `: }with (document){
4 d: w9 E  G7 m) T, h/ p$ wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 j3 X+ i3 j4 d: y3 b- X9 O% aif (iedom){
1 F6 D7 \2 p4 E' @) l6 L& d8 f, v7 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" @' Z1 i4 B1 S6 }2 _: ]+ ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 i7 H/ p0 [. e6 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# e+ G* f  P3 i
write('</div>')
% _5 ?! q8 g* ~9 n; h( M0 `}
* @% B3 K# r4 ~else if (document.layers){/ t3 ?: j. L3 J+ d$ d1 P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) i9 o. ^" [" V; l( Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). N8 j/ O" O, j) F1 j. Z- d
write('</ilayer>')
6 a3 q  n7 @6 ?. o}% q* n; F4 c, h
document.write('</td></table>')
5 T* E! `% }) h$ g! [}* n! O4 B& C2 A% X! v
}
7 q' {) @7 T/ e) M</script>

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