返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 k# f, j: F# p3 c& w' {6 p3 cvar marqueewidth=300
5 s% P6 c& c) L# O# `2 I6 U: V//高度
% n8 D& ?  v8 `var marqueeheight=25& j' t- K% @' W, g
//速度(1-10)
2 S; c8 r. y! i8 R6 fvar marqueespeed=3
3 X* r3 @+ S: ^( I3 k) U//背景颜色
% I* f# g4 w0 c6 z5 p6 F! V: `var marqueebgcolor="#FFFFFF"2 k9 W' p- t; Y5 V8 W
//是否能暂停 (0=no. 1=yes)?
7 {1 z  e4 H# P' g4 I! G$ U' B0 a* hvar pauseit=14 |, w- a# `) M9 C

* X2 {9 {4 e" \9 T//修改显示内容+ y+ E$ r4 V8 ~7 k$ Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# L" U' \9 \. J$ e& F# V
: M; l. [: J" K! [. L( b7 Z* w$ f9 \# a7 a
////下面不需改变////////////
' }5 ^. X+ n2 ?5 ]+ s! f) p. t
var copyspeed=marqueespeed
8 {: c# k! U+ G* `  y0 p; E: fvar pausespeed=(pauseit==0)? copyspeed: 0
" A9 E/ d5 a5 f0 M- W9 p2 mvar iedom=document.all||document.getElementById( W. L9 L6 }( o
if (iedom)
* s! }6 M6 D1 G: _" E0 V; y& _( Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# V0 G( _: Z  r, S" _( F( avar actualwidth=''
7 f/ c! z0 E  W; L" L0 svar cross_marquee, ns_marquee
8 \8 j7 W9 x& I& r- v, M( p
) ?2 @/ H- v8 `7 Jfunction populate(){  \- b4 X' n# z2 I' f
if (iedom){/ p1 f4 i) L; Q: g# ?% X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 P8 F/ V) g/ |- c8 d9 scross_marquee.style.left=marqueewidth+8, h( b9 x# t. \6 j- p2 \
cross_marquee.innerHTML=marqueecontent& J' o8 L1 P$ ~# {0 f' @$ o( x6 q# {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, N+ `8 x: Z$ e' o( w}& y% p$ t5 a& J- ^' W. m) F
else if (document.layers){
' |: ]. L7 R0 t+ B. E9 P0 Bns_marquee=document.ns_marquee.document.ns_marquee2
1 m; n! ?' i& u( x- K# rns_marquee.left=marqueewidth+8. I& D/ s$ x. ?7 ~( a$ a
ns_marquee.document.write(marqueecontent)
; {/ D1 S; f  P3 c' Y/ |, I4 jns_marquee.document.close()
# x. V$ T7 H# Q! v+ t: yactualwidth=ns_marquee.document.width
6 z5 F! B# A" |4 q) @# O}
+ ]+ Q. j' F) |# ]% r" rlefttime=setInterval("scrollmarquee()",20)8 d# {! b  a3 V( i/ F* ?+ g
}  h0 u; [7 H5 Y6 J: a
window.onload=populate
9 e: v3 o" n# _5 k# P) ]* c3 e; N/ R) C7 S7 s+ G# H; W
function scrollmarquee(){4 u6 ?3 _' Z. p  Z/ B* o, J
if (iedom){
" E4 G( H: H* |3 \7 a7 @  e9 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) p5 R3 U4 ]1 |) g9 }$ Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ z0 K! X& b' \' v9 x  T( x
else
. R, A/ F) F! [# Jcross_marquee.style.left=marqueewidth+8
+ D$ n/ B+ H$ @' Z! u! ~
% E3 Y) _5 t3 ~% E) X5 t- P}
- d; ]; B7 a: ^else if (document.layers){, F# \. I9 N7 t6 v2 s
if (ns_marquee.left>(actualwidth*(-1)+8))
2 l) H! j9 y* l) w1 M2 D' A' h, p5 ens_marquee.left-=copyspeed
6 i7 d; b& n4 C8 @2 [( Telse
: c. a6 v- z) A3 r1 {$ U# fns_marquee.left=marqueewidth+8
% f# G1 H, N5 D. l; D& N}- q( M1 d6 N2 \- y/ r
}
. R9 i9 b- h. P+ q* _: i: ?
) Y5 {" S/ \. [1 V+ _: u" O  L9 Oif (iedom||document.layers){9 A5 v$ E- V& u
with (document){
( ^2 W7 D* `3 B: p' J- l6 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( D; |& D' j% B
if (iedom){/ Q3 U9 V! v$ ]$ `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" z1 G+ u% |) F1 T$ K" @5 T# e2 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): I# Z5 s. }  o+ _: i% b4 |! g1 A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 K  F+ t9 k  Z) s- ewrite('</div>'); k9 i4 R) ^2 M+ c. B! V
}
0 r2 a9 `7 I6 b$ jelse if (document.layers){
' n6 O4 ]5 O5 E$ Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). d# l( J0 l4 }! h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ `, O' v2 _: Z$ `) a2 a
write('</ilayer>')9 j3 v8 {( w; R6 s  k7 A
}  o  G, [* [1 u" `1 ~
document.write('</td></table>')5 l" A* @" ?, i9 K
}+ U& N8 G  x) }
}  F1 H/ m4 ?; N8 o8 |/ K, }5 G
</script>

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