返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" X6 N& g5 M) [var marqueewidth=3009 S2 J' [. l. n7 M. G  f/ A% R% R
//高度
2 o$ r4 Z8 }$ f5 n2 S- [% P# Avar marqueeheight=252 U; _" V' [9 U+ ]/ U9 B8 R2 n
//速度(1-10)
2 p% A; T, h4 u' R& Tvar marqueespeed=37 f# x7 f: ]7 z# g
//背景颜色
& f% j7 ^& V( R5 x* L8 ~var marqueebgcolor="#FFFFFF"
. v" [) z" l7 g( q//是否能暂停 (0=no. 1=yes)?
7 K) T. |% X. y# M6 Rvar pauseit=1
0 s1 d/ a. q+ ]' B$ B2 z/ r; Y/ M0 t- _
//修改显示内容" `1 S- x, p5 r8 s1 a. _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 q" }! H# o% L, `) k* ^' K/ l/ I; o& [$ A4 Y
2 e3 J9 V! V+ ]) l6 `
////下面不需改变////////////
# G$ i+ {: b1 M6 S. J) u
/ L* X* n% I# p4 c" c! d& tvar copyspeed=marqueespeed
4 U  a( \4 t) E& V8 wvar pausespeed=(pauseit==0)? copyspeed: 06 C+ c. `+ m' T' D1 Z
var iedom=document.all||document.getElementById* I$ n: p& I+ C" k5 o
if (iedom)+ b0 f4 i7 H# N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 U8 y+ O/ n) L% ?0 M
var actualwidth=''
6 s0 _, e3 N9 }4 qvar cross_marquee, ns_marquee% u/ A- V/ H8 V  i
  n6 W! q' b2 t
function populate(){
' `* c- `/ T6 h! ^4 mif (iedom){
# m; X/ ^. ]" [4 N2 e% f8 ]% bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ f2 v  g0 l# t+ k# O- pcross_marquee.style.left=marqueewidth+8
0 J) t6 e6 }" a& Ycross_marquee.innerHTML=marqueecontent$ }, f  g& E$ ~# N6 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: }. q) a; a4 N' o) |( O}0 `( c1 ~1 Y3 _2 P  z- [
else if (document.layers){! M; \: d5 \3 y& X. q- A0 I
ns_marquee=document.ns_marquee.document.ns_marquee2
5 g7 @. [8 J" p- P! rns_marquee.left=marqueewidth+8( P7 G1 X0 C$ k, G) n
ns_marquee.document.write(marqueecontent)  ]( t5 K; L- F# w0 _- Q4 e8 M
ns_marquee.document.close()
9 ~- h& m* L. O5 c/ A. Cactualwidth=ns_marquee.document.width5 z: m* i+ C* b& w) a
}
3 y5 [0 Y3 A# W! F: `lefttime=setInterval("scrollmarquee()",20)8 f8 z( k# Y) A; a1 B/ ^6 J- |( s
}
  J: B$ e9 f1 Y7 c+ Owindow.onload=populate$ \0 C: l' @  x, K& l$ R2 n
" q6 v& \5 v) {, w9 B" d: Q
function scrollmarquee(){# ?7 |1 [7 {' f$ R
if (iedom){6 ?- ~, i- I) w0 l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% p& ~# V1 L' |6 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 P8 M0 y. E/ p3 _else1 b8 U& \* V4 a% X
cross_marquee.style.left=marqueewidth+8
: ]: J+ i0 h# D" K6 y5 w
6 I& r( G! ^1 [! R( S}
. X) t4 L8 a4 a9 h. a* o: uelse if (document.layers){
  H* ?3 m: M& `9 |if (ns_marquee.left>(actualwidth*(-1)+8))
; D% A9 q" r  H, h' g9 U7 O( Dns_marquee.left-=copyspeed. j+ |* p: J1 D
else
6 T. {+ ?' X: f6 r" A, v% [ns_marquee.left=marqueewidth+8
  e/ e3 A) M) M- t}
. T# A6 u- y; {: r; H) l}4 Y' Z) V) P/ J, R

6 B0 V; }- e* p' b$ p! W& zif (iedom||document.layers){9 w& Q. T* ~! H  ]
with (document){4 |' L1 |! x' h. J, R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# @# l- J" g( ^% Mif (iedom){
' T4 J' K% D% f" X" V9 q$ pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. E: Q  b; }/ m: Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( t0 [* k: H2 M) I* N0 cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 z( h0 g  t) E5 ~
write('</div>')4 M+ J- q/ X) \/ J" o- w* n
}
- z) R" o' e& A6 u4 [6 nelse if (document.layers){: |. v  i6 @4 R, q4 O% O( a  Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% v8 H4 j; S- y0 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 k/ {( W' n: E- l$ v) ]6 Awrite('</ilayer>')
5 z4 h9 b0 ~3 r) g: C  K: j- E}- x0 Y$ h% C: ]9 {3 `
document.write('</td></table>')' g- X( W6 w$ N4 Q8 R+ V
}6 n$ ]6 I0 x3 n4 {! f6 b# v
}, f" }7 {7 R  T0 \
</script>

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