返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 \9 T7 X; P8 T  t- r
var marqueewidth=300
4 P3 m/ N' |- E7 W+ E) F, a& G, b//高度) G! S6 Y5 H9 T) n9 b; S$ ~
var marqueeheight=25, M; r- M4 D9 G, M4 o" X
//速度(1-10)* I3 @8 `4 A7 y  }8 R
var marqueespeed=32 p2 {4 l' Q& X/ o2 w) _+ q
//背景颜色& _; F5 E3 X. @
var marqueebgcolor="#FFFFFF"1 C- v( b4 N+ D2 s  E
//是否能暂停 (0=no. 1=yes)?
4 G' L" J- K0 Kvar pauseit=1. D( Z  B4 L( W& d5 m$ q9 `
# Z. g0 t5 G" b* A/ |- |
//修改显示内容- A  r$ y, y7 a( B/ p  _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( x( G& X+ F. \" u
  \* x- X0 g! G# C( C; r: r) {2 b& a
////下面不需改变////////////
8 n/ |6 A4 _- M: M9 l0 I7 R6 e* j5 N! z" @2 u
var copyspeed=marqueespeed
1 z" K. ?: ]3 k' k# @1 T7 ^var pausespeed=(pauseit==0)? copyspeed: 0
/ b5 t% A7 q  v% \. s: T6 uvar iedom=document.all||document.getElementById
4 Y8 l) B; d( \9 Bif (iedom)* k, g8 g5 z/ Y4 b7 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 E* L. F  O  a
var actualwidth=''
2 p' y5 u+ ]+ p. j# O  Hvar cross_marquee, ns_marquee# c$ J: M* y. G! P

- M  U- `4 `6 r- I1 a7 }function populate(){. T: q; W4 l8 ^# }2 \" \4 U7 e
if (iedom){
( Z' b* Z( \9 x7 r/ h# {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: ~0 I6 v: A6 Q; i. B: t# Z  D/ e
cross_marquee.style.left=marqueewidth+85 {6 k) s8 J! M
cross_marquee.innerHTML=marqueecontent
7 t6 s2 c% q2 {" C. Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 b, Y3 A, s7 x7 a: N}5 F9 K1 ]" K- M4 i
else if (document.layers){
" H3 S! \$ p( `8 l- i1 Gns_marquee=document.ns_marquee.document.ns_marquee2
$ i  O* T. L: ^1 O! B4 ]3 Tns_marquee.left=marqueewidth+8# y+ ~. Z4 m' b7 X& B1 h6 c3 a
ns_marquee.document.write(marqueecontent)+ `4 O% e" K8 k- P" k9 g9 Z1 }7 n
ns_marquee.document.close()
$ J2 A# f  p7 n% b( m5 m* tactualwidth=ns_marquee.document.width9 x8 I5 \. U* R4 h: \% a
}: w. ?4 k+ M" K* r
lefttime=setInterval("scrollmarquee()",20)$ O- U7 Q% v0 b" R
}. p/ T* u+ u/ r
window.onload=populate
1 G5 \- u0 ]0 N% p: b* z' F6 w* b4 G4 U' j2 b0 W) ?
function scrollmarquee(){. m( Z$ i" ]- C& M+ o5 f
if (iedom){
9 y* O% b3 Z2 fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  H% ^  {8 R0 t8 Y4 y4 O5 S- ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 o5 p8 O3 t% c
else
4 B, q6 I' F9 v! t  Vcross_marquee.style.left=marqueewidth+8
6 k, N# H* Y0 E6 Y' V' X, Z# ^% U3 Z  V9 `& _+ e
}" R4 W1 h3 V% S' ~
else if (document.layers){4 j& U0 e! `6 i8 @
if (ns_marquee.left>(actualwidth*(-1)+8))' I2 D& K! ^1 b
ns_marquee.left-=copyspeed
7 D* O% g9 z, s$ s4 Ielse
) t5 I, C: |0 K& b  ^ns_marquee.left=marqueewidth+8
* k& `  B7 P) e& E% ]* ^}
. V9 \8 }3 A6 _: @; J0 o}
8 O3 L) |6 [2 f. B1 x; l% Z8 B& ^& p1 o, v" C. s
if (iedom||document.layers){+ d. V" Q$ j7 A+ u( W& p% s' ?
with (document){, k& ^$ F, c8 E9 J5 O* |+ D/ r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 d* @6 b$ T0 Lif (iedom){
( L; F+ Y: X6 D- V) [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) w4 d) X0 z1 }  m1 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): e" ]' o. f; B" ?1 Y4 J- K) c, k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& [" K( }0 w& q9 w0 _! [( O. l
write('</div>')
) q! Z4 M/ u: }}+ Y; q. l5 L2 b8 c% P/ `
else if (document.layers){! F& c  J2 \$ d. F* h/ F: {8 o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 s4 {: I: U1 f( Q; ~) K( G. V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. N/ ]0 M* A% k, ]7 f" H; I1 zwrite('</ilayer>')
3 Y4 Y9 C3 Y) U! O; U# i% Z5 Z}
( A; ~* M2 r2 m6 p+ n# s0 e6 ^document.write('</td></table>'), t0 _1 a! e4 {' p0 h
}
4 ]6 X: N( ?5 l6 _& c9 s* m}1 P; r+ ^% M+ G3 s, z: P0 _- n
</script>

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