返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: {# R# b# P# E) Xvar marqueewidth=300
& }( i3 q1 t* C& n9 ^//高度- @: Z% |+ C7 L1 c0 C# e: @0 V
var marqueeheight=250 [6 n5 {% g0 E  B
//速度(1-10)
( V1 C, D) F) g# Gvar marqueespeed=3
# `) ~+ ~- q7 Y5 Z3 E1 e7 P, z//背景颜色8 g9 ?, U- X% z0 G1 ?' `5 Q
var marqueebgcolor="#FFFFFF"
0 z- P$ R6 B9 L1 B8 E//是否能暂停 (0=no. 1=yes)?
: W& {+ ~6 I; L3 H- N) Kvar pauseit=1- j) ?0 v5 }" c# [5 Z
' l( Y1 ~/ b6 _; A7 R
//修改显示内容
* T; t' ]" V% Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; Z: M3 v+ x1 v, k; O/ R; A
5 q) X/ f2 b; s0 g( ?; c. d. ^, N- N: @1 x$ \
////下面不需改变////////////
4 z+ |2 f+ Y" M; h" E9 _
3 @7 n1 [- ~8 _' O- g" vvar copyspeed=marqueespeed, t  m9 B/ a- Q% `) `1 ]+ {+ V! R
var pausespeed=(pauseit==0)? copyspeed: 03 J. ^( u& f2 k$ T
var iedom=document.all||document.getElementById
8 @4 k: v( O3 l3 X( mif (iedom)
) K0 j1 V+ `9 @0 U( Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): `- {; S, ]" f/ O
var actualwidth=''8 F# p+ X. o  E; t0 M6 g- E# S
var cross_marquee, ns_marquee  Q1 y( Q; a4 \0 U

2 l. U% ~' A0 Z8 ?, Vfunction populate(){0 L. Q' T" M. |) @4 J3 W
if (iedom){
' T: n' H: x5 d- {/ A6 lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 m$ a3 Y" _1 H5 `  e5 X! Z
cross_marquee.style.left=marqueewidth+8
/ d3 x2 u+ c; ^; ^" k1 {* Ocross_marquee.innerHTML=marqueecontent4 h1 X' i* l3 l5 X& k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% D: c7 Z3 J. g, j$ h2 s
}; X6 ?; c% R) B' d( q
else if (document.layers){
4 L- T7 w. g( ?8 @- [' dns_marquee=document.ns_marquee.document.ns_marquee2: v4 {* d4 |9 I
ns_marquee.left=marqueewidth+8
+ ?" o) x5 E3 d% ^, U4 Gns_marquee.document.write(marqueecontent), [/ J( `1 W! [9 i( \' D
ns_marquee.document.close()4 C) ]4 g- L8 y- s( t
actualwidth=ns_marquee.document.width
( U  v9 d, y6 m. T( X8 z}( S+ z# I( X* c1 n" @  H3 S1 m+ l
lefttime=setInterval("scrollmarquee()",20)
9 v" B' a6 j% N9 X  y# d}! S* ~) H. p, ]# C9 t6 |# O' g
window.onload=populate
- {4 O) J  C( x. J! c$ X0 @4 J! v3 I5 M  p+ v( S! U( n
function scrollmarquee(){: U9 }7 O' x  S% H( D0 u4 E" R
if (iedom){
' [, {& e$ m0 W, h( qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# i6 ~4 B1 n9 [5 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# Q  b  X6 u; R+ ?5 x" qelse9 r( U" |6 a8 j: E
cross_marquee.style.left=marqueewidth+8
6 T; k' V' g( k& [4 U3 i, _4 G: I1 k- L
}( Q+ q& b0 `+ A' z
else if (document.layers){8 q3 ^0 W2 T' Z* `3 e: G) H! ~
if (ns_marquee.left>(actualwidth*(-1)+8))
8 r2 j( n4 q2 f& J4 Dns_marquee.left-=copyspeed8 L; n- [5 g5 Y) h* v
else
4 M( Z4 t" T4 X7 u# Wns_marquee.left=marqueewidth+8
9 Q, S. p! s! o' Q# o}
! v  o# _, x# {4 l! i: C- F' N$ P}
$ s# V4 V; _( U0 H  Z5 e/ J0 Q  }8 ~7 \/ E
if (iedom||document.layers){: N& y" s3 l$ M5 ?$ {% o7 _) V
with (document){/ c8 u/ I+ h- L- Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 |& H6 N; d7 E3 i4 h  Cif (iedom){6 S5 D! G+ H1 m  s+ Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# ~$ L1 P5 B0 z5 f' @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" D7 b! \. b  I& q% p! Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( U& e: W$ ?) J1 u1 \write('</div>')' ]* E; C: s1 w7 H0 O
}
% a5 _7 Y4 s' P4 w: yelse if (document.layers){8 e: C% R* l; t( T5 f, x( x4 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ t% E& [& a( A! d" T, w$ f4 Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  M, ^) v8 K. ?2 z
write('</ilayer>')+ t6 a- i  a' R/ i; Z
}
+ f; C2 C2 L; S: Gdocument.write('</td></table>')
) K8 U; X+ r7 ?. D6 g- R}
% `. H# k) D* }( A& x}
6 g2 ]6 C7 r0 ~# r) h</script>

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