返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# g: N& x8 B7 G, B  C; \var marqueewidth=300
6 E5 H) \2 h; @4 ^//高度
1 Y# D# F) X3 ^, t/ p1 Xvar marqueeheight=25! K( n) k" ~# V" {& Q1 N
//速度(1-10)9 D; V. D' y9 Y  f+ r; p
var marqueespeed=3
1 x" Z: p. G% m' P1 L0 H' Y5 ?6 U//背景颜色
7 g  `+ d) D( I! \8 x2 Cvar marqueebgcolor="#FFFFFF"
* y% l6 X; Z1 i2 d//是否能暂停 (0=no. 1=yes)?
0 F( f& w* o. {1 G3 T$ H6 jvar pauseit=1. L. R" A# n! e7 D: w: B5 h

% K9 Y3 {, v8 q' c& q//修改显示内容3 \; I* |5 e  L0 m" e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% q* ~8 U( w, V2 K+ R- f- B: ]9 K0 U" n0 m

/ r% P& `& i7 Q/ n5 O////下面不需改变////////////
: b5 @+ L: V2 a4 _" N3 b. W$ U% u, `! u# d: ^0 n) a) M# v
var copyspeed=marqueespeed
8 N& J( i1 Y$ ?5 H9 uvar pausespeed=(pauseit==0)? copyspeed: 0
$ G9 A9 }5 J) x/ ?& Cvar iedom=document.all||document.getElementById1 G6 @6 g3 w8 i0 T
if (iedom)% j) p$ a/ e' {2 q1 L5 {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& O: V( a# o; e' B: W* T7 d
var actualwidth=''' `! p# r# n9 y6 D
var cross_marquee, ns_marquee
5 H7 j# j. @1 r* [4 }  l( \$ e/ b/ n& }% X4 \
function populate(){
: }* L+ P9 i" _if (iedom){
4 ~2 y. e, c7 {0 g. ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 {7 m: I1 h1 o" P
cross_marquee.style.left=marqueewidth+8- X$ D" Z1 [3 l+ \5 I( B  C
cross_marquee.innerHTML=marqueecontent
+ k) N& E+ {8 V& b% T. |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% V, s0 B7 r: E+ k) A( W8 a}
4 j9 n& A4 ]# d- f% |7 P/ welse if (document.layers){
2 F' p! S2 j) ans_marquee=document.ns_marquee.document.ns_marquee2& K( Y6 P8 H2 l$ A( G
ns_marquee.left=marqueewidth+8
8 T2 L: m$ ~2 sns_marquee.document.write(marqueecontent)- o; X8 P) J* I# u! K
ns_marquee.document.close()6 m3 m, ?7 G6 g% J) D" v
actualwidth=ns_marquee.document.width0 `  ~) c3 o0 Z/ D
}
1 E" `5 |9 b. g' l0 v( l3 [lefttime=setInterval("scrollmarquee()",20)* t. [+ |( D" r: Z
}
7 p" r0 [, C3 H- {' [4 |window.onload=populate
8 }% R% x7 S% J9 E
! Q( V0 @& h9 L+ E5 d$ d5 ufunction scrollmarquee(){
1 g  _0 x" `8 ]# v0 u- }& ^if (iedom){; y4 k- a% u# ?7 L8 O2 k! O5 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) o4 A8 N( t0 r) d, vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. Q: e9 u& k2 B- ]- f/ t% t: a0 S/ Relse
5 ]& _6 ?. k' i3 Gcross_marquee.style.left=marqueewidth+8
/ P3 A1 D' W- I. {% y' a: x5 W1 v) _" M
}1 G( ?. O+ P9 K% o3 ?
else if (document.layers){. u$ I: c+ h) ^: q0 s1 Y- W
if (ns_marquee.left>(actualwidth*(-1)+8))
6 z6 ~& S8 {  u% gns_marquee.left-=copyspeed7 [/ H# v6 Z9 ^8 J# g" |4 a* l
else' I* H9 y2 X9 A1 Y: l! _$ c  _
ns_marquee.left=marqueewidth+86 ^; ~, f0 f8 Y# w* f  c# L
}8 P/ v/ p2 u9 M% Z( C( S1 O# w
}8 O/ X8 J7 ]& n" p

1 ^' {, L* v$ S5 G0 f7 ]9 C2 [- k# _if (iedom||document.layers){
& d  K/ B9 j6 V3 p: b7 o/ c+ kwith (document){
" J2 N  J& P( t! C+ f9 v6 Q- y& m& adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: H- J7 P$ Z* U' X% uif (iedom){9 q! j9 R. E1 t% K* F2 {& C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 z5 f) ^: T8 S: k$ y2 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 L& I5 ?( {5 _- q& _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 \* a+ g1 U1 T& L( b9 [$ w  p, bwrite('</div>')2 M7 b6 _2 Q4 W
}
+ n1 z9 u+ R% e& gelse if (document.layers){
" e+ s5 A! Q4 k" Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), A& y6 B2 R  |/ a" y6 a6 H0 m4 T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& n- v3 L6 J) p- J/ {1 E  q( |write('</ilayer>')
  F: ]7 f( k- k6 U" ?; x# Y+ X}
6 Y; B# L+ s4 K% k$ u5 Q& p+ adocument.write('</td></table>')! k7 p) X; o) N+ }' C
}
" [4 G3 O+ V# ^. u}+ @& F: Y& u7 q
</script>

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