返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 W) l) T2 H4 E( B  L
var marqueewidth=300
! v' z2 B2 O. p# b! N* B7 G. R! Q//高度! x- n% ^+ O6 N5 u3 c) X8 j; _
var marqueeheight=25
; d5 W; C% Z" `; K//速度(1-10)" i0 Y) z( o5 W& v
var marqueespeed=3
% Z4 @6 B1 o  f% D. D. d//背景颜色# ^) D3 y2 h1 Q9 C1 d% W4 Z9 \# d+ z
var marqueebgcolor="#FFFFFF"
( h1 Y9 c3 w' D* @4 l: q; t//是否能暂停 (0=no. 1=yes)?
8 n& j6 l. `% |/ O, H; Q+ |( jvar pauseit=1$ k) t9 F4 V3 J

0 K4 A7 d  b. M& f+ W, f# D//修改显示内容: H* C3 f3 ^; ]+ Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 K% U) F8 q2 G0 r/ s3 t" l

4 o) H2 S  @; C7 `' h' n: R# O8 ]9 O
////下面不需改变////////////
+ {$ B( n3 y+ ~- p: x0 P/ T
* T0 l6 D0 V- M# x  P: Fvar copyspeed=marqueespeed
' A% B" h6 Z4 H/ ^6 z9 d! B/ Ovar pausespeed=(pauseit==0)? copyspeed: 09 S. @3 D2 R& g% U( i
var iedom=document.all||document.getElementById. d1 b$ b3 {8 d+ O# t: v" V
if (iedom)
. F: i, h% ~9 o1 j, idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ ~8 _( w, j$ r! Kvar actualwidth=''
6 U, g- G6 Y# k+ R% R8 gvar cross_marquee, ns_marquee
/ G8 A8 ]- m" m  |0 x/ k# ~/ }+ z5 k( |8 c8 K/ F$ y
function populate(){
: V8 {9 Y; J+ v+ b: _5 cif (iedom){+ J* h* C; Z+ V* I# O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% x/ ^) V% \2 d# F6 F6 _+ c! W
cross_marquee.style.left=marqueewidth+8; G9 P  g/ Q$ u* P; w
cross_marquee.innerHTML=marqueecontent
. B0 w* H% W' Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- `) [% i8 v! p: J. |3 `}* s; c; l: \& O: w
else if (document.layers){
0 g  x. L$ P, Q, b+ ?ns_marquee=document.ns_marquee.document.ns_marquee2$ D# }- I4 {3 u: g1 W
ns_marquee.left=marqueewidth+8( Y, F" @6 z2 @$ O8 }: y
ns_marquee.document.write(marqueecontent)
, Q' r. L0 P+ v5 C; [  ?! Ons_marquee.document.close()( ?9 D6 C5 g: ?. C
actualwidth=ns_marquee.document.width7 `2 N, U6 w5 P
}
' ?( L  T; _, F1 v+ Wlefttime=setInterval("scrollmarquee()",20)) Y0 W) l5 k  _$ H$ p
}' o' ~7 Y, @+ [" ^: g: ^8 Y. U0 `4 [
window.onload=populate
& Y+ X9 m- S  h" R4 \% r, u3 K/ D1 U, @: F: F. ~/ @% |8 p
function scrollmarquee(){
$ L: A# k. x; k# @4 v% {, Qif (iedom){
8 D8 {+ O( I2 v! |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 ~* l- c8 @1 g' P" y3 F* d& B$ N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 I0 a' b2 ]9 a% l( Aelse
/ g+ I3 m- L/ ~( h6 Pcross_marquee.style.left=marqueewidth+8( C. q- i# D. C: e
# t6 I; Z/ n9 \
}  b, P6 p0 e; a: O- S
else if (document.layers){4 ^7 J. i1 U& R7 u, o
if (ns_marquee.left>(actualwidth*(-1)+8))
2 c( J% D+ l% x2 T) R8 V4 n1 Ens_marquee.left-=copyspeed2 s" `/ u# B2 A/ @
else
& B2 D% S3 e: Z5 B) t7 g+ Z! Nns_marquee.left=marqueewidth+8) u& D/ @0 E+ O0 Z5 f( ~; s( ~% t
}6 W* A# d- D5 d) N  x
}
+ e7 x6 u1 X$ P" p* A+ ^; }
. v  h. s* l; z. |% _if (iedom||document.layers){: h' _0 R6 U) d6 E7 f4 k
with (document){
( P* l  k3 v1 _7 n: L' h/ g& Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 i. w( P6 Z" q& H$ L8 N; @7 Fif (iedom){
$ b& u) X5 K6 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  Y9 d; ?7 q: J4 G8 C* i1 v( Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 ^9 A* j) ~' I- u, g$ v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" L. l# R7 p6 X+ C3 Gwrite('</div>'). \9 e9 T4 ~7 c, o( b
}- m9 w4 p& B. M9 S& H7 \; s& L
else if (document.layers){
3 C; L( b0 [! N8 O2 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ t' h! u0 A) [0 a6 K1 d7 V$ z# Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 X* W6 {2 b; F  K! M
write('</ilayer>')
' {' S& i( ]( u9 V: f5 s% `+ }}
" W1 y+ u. I2 J- K6 Qdocument.write('</td></table>')
) r3 U" w5 c- q, s0 P  d6 f' o}0 y' E( k1 z5 r: P- Q) s/ E
}5 Y# u! G1 ^! m; y9 k1 k
</script>

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