返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 z; C5 p9 X7 q6 \
var marqueewidth=300
& s8 z8 [0 a5 B5 V//高度
2 x+ b5 v: |- g& O0 G- |* z9 Tvar marqueeheight=25  }/ G% `' u- A7 F) _/ V, A* ]. Q' p$ f
//速度(1-10)- S7 o/ T4 S' O: V- X) J
var marqueespeed=36 Q+ Q! l& E* S7 O. ]
//背景颜色& ^, J, O9 ^4 \. N8 ~
var marqueebgcolor="#FFFFFF"" f( X" a9 _. `4 R8 N( A. l
//是否能暂停 (0=no. 1=yes)?% p( a8 \" R' V3 O! G- `
var pauseit=1
* s7 C" E4 v: J% ]9 L: {+ N0 ]/ @2 H: d- m
//修改显示内容0 c; J5 O9 r( I1 Z- ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* c3 r6 a; o8 k* ~, V+ o

1 ^7 k7 h9 |. e* L  A8 M0 k
% y- t7 G5 e: m////下面不需改变////////////0 q# W$ I9 I/ }! N: t0 u: B
" o1 p8 _( X- k( M
var copyspeed=marqueespeed
  l5 q) U8 ~- m# ^( L& F1 A4 X; zvar pausespeed=(pauseit==0)? copyspeed: 0
" m/ \! C5 H( J1 g% v; o! n2 ~var iedom=document.all||document.getElementById& ~7 Y4 P1 t, d
if (iedom)% b. @, s3 O" H9 @. R- I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) S% W3 |2 v/ S; f' J% ?3 s
var actualwidth=''
, q* Q! J3 r+ }; f' K) Vvar cross_marquee, ns_marquee3 o9 K$ {( o1 N9 e% [5 `) X

1 F1 P5 f0 ]' A1 @0 zfunction populate(){/ y& C* n. G$ \. R/ k+ r7 \
if (iedom){
5 O- c6 H& K% R0 L3 Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  ~5 ?3 Z6 o. b( h3 G
cross_marquee.style.left=marqueewidth+88 E& R' y( X# a+ {' z# Z$ _$ o
cross_marquee.innerHTML=marqueecontent- d4 j* }% q  C8 Z7 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: g2 E# D6 q$ h  [: ]# h
}
4 n9 ~* Y* L2 ^3 velse if (document.layers){
' Y; ?, I0 A- C3 ^ns_marquee=document.ns_marquee.document.ns_marquee2
6 K" B. P9 E# Y# L# gns_marquee.left=marqueewidth+8" g5 g1 S. y2 {+ I5 x& V; N4 t
ns_marquee.document.write(marqueecontent)2 T+ p3 R: H/ l
ns_marquee.document.close()
9 r  d( n( B3 l) {$ cactualwidth=ns_marquee.document.width# e2 j, l" b5 M8 p- S7 {7 [
}' J9 V5 y- B0 }3 p( c( `" ?
lefttime=setInterval("scrollmarquee()",20)
- i4 m" T- {1 {' k% A  x}; ~' S# j5 R, @2 `' M
window.onload=populate6 K9 K$ N, h* D+ @2 f5 E) W" p8 W

3 o8 Q% O1 d) e* g) M4 Dfunction scrollmarquee(){8 s- e# Z$ a! v  E7 P3 u% X4 k
if (iedom){% A& N) Z" @9 U3 T2 R: ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 A; `' Y- Q2 @3 h7 a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% A9 x0 K  Y0 n' C! [8 [
else7 Y) j- ^: F& N% o1 Z' t; j
cross_marquee.style.left=marqueewidth+8
7 i8 M2 V" a4 H1 \
+ H  U# b9 z! I- |  ]- n# z}- [: a2 Q3 Q9 @* Q: W0 d, L
else if (document.layers){4 u0 ^5 k& G4 _% e7 U5 O7 j$ E
if (ns_marquee.left>(actualwidth*(-1)+8)): J2 c$ r* P( Z- [: a& E
ns_marquee.left-=copyspeed. |: c* v5 b* x2 a& {) Q4 z" @
else
# ~* [0 N; b/ S1 D3 b1 @; E; ~ns_marquee.left=marqueewidth+8" f4 o" r4 u8 A; K  d
}# P5 P# K0 @. ^$ S' }" w7 I
}
9 @2 K5 o7 h( R/ X" F# `* H) D6 V7 G; S7 P+ F0 q
if (iedom||document.layers){
; |. X$ O5 H1 ywith (document){
& R1 S: Q) C2 w3 s" _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: a% F0 \# s& b0 U/ ?if (iedom){" u+ ~0 S  F0 g/ w. ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& h4 k/ f7 ~+ V4 L: k4 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' f2 g6 n/ [9 M9 @; Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 F' m! m4 d/ z) e
write('</div>')( B4 @2 k5 y" I3 Z) c* l* x
}
  t) ^/ F# [1 M' e/ selse if (document.layers){4 d$ K8 d9 L8 s5 p# J3 E. {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  ]: |; ?& U6 Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( e+ L* I7 ]' a: o# \% x9 k$ Qwrite('</ilayer>')' G6 B6 _+ O( x: X& |* E
}
3 N4 a5 t  D6 |* O" t; Ndocument.write('</td></table>')# H7 Y. r+ K( p. ^8 y: Y: p
}5 U' d% q' ]( `
}7 c+ N& ^# C) F$ b. ^8 o
</script>

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