返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ }: h; L5 [, d0 K+ G6 f
var marqueewidth=300
) s# H9 O- O+ ?/ c% j' \2 Z//高度4 a: D& H. V6 C- ~0 o
var marqueeheight=25. a2 E/ ?9 E" Q- v: n8 H
//速度(1-10)
' F/ \& b2 H: J3 ^! ?& U0 ]3 Gvar marqueespeed=3
4 V% E3 D( ?9 w0 a; N7 r+ Y//背景颜色
* g, x/ Q* [7 J% B. J$ Fvar marqueebgcolor="#FFFFFF"& u& y8 I4 C; P; }- A# @
//是否能暂停 (0=no. 1=yes)?
& K) y/ B3 ~7 \var pauseit=1
2 y9 E* Z( `5 t# s, W" |7 V# h8 _2 w7 m9 e2 y* {7 V
//修改显示内容7 \$ C; ^; q5 Z3 U) p' x8 ^, H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 S; i; T% I) B# ~) u2 H0 ?5 D- k
3 s& h/ s: K  t& S
+ ^3 V& p3 }- `////下面不需改变////////////* Y6 k% W  w0 O3 d' W$ U  k

+ t/ {" m1 F+ W2 n1 _/ ?6 z- vvar copyspeed=marqueespeed
/ X* O0 O; ?& \( m) _6 lvar pausespeed=(pauseit==0)? copyspeed: 0
5 A# [2 _3 n- O+ Wvar iedom=document.all||document.getElementById
+ V# X' h- I1 ^0 h: N* }# ]if (iedom)
/ Z, ], ?7 H! i' l1 n9 y2 K+ T9 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 R: m0 `+ i) C8 i) t
var actualwidth=''& d% D& }( }1 T8 z# ^( Y
var cross_marquee, ns_marquee
) b( g( d5 {! g" I- V: S% C( S6 g! a8 O
function populate(){
2 x7 [9 l' Y, _$ j$ U$ Z3 Qif (iedom){
7 h9 y+ j- w% [& B. q( C8 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! i, z' B: Q4 y4 v) G# \1 U
cross_marquee.style.left=marqueewidth+89 W* y' a. A8 U
cross_marquee.innerHTML=marqueecontent
' j3 S- q2 l2 X& i% factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  G$ v) J+ U2 P; v/ Q}
% c2 E  S" h% k5 H1 f, `% R! Z. Belse if (document.layers){
5 O9 f: L8 S& x. n' [ns_marquee=document.ns_marquee.document.ns_marquee20 |7 f- ?* T' }
ns_marquee.left=marqueewidth+8, h+ q% O. h+ l& X& V
ns_marquee.document.write(marqueecontent)
, B9 F  a' P, I. e$ tns_marquee.document.close()( O5 Y) y8 Q+ B1 A' S
actualwidth=ns_marquee.document.width
, H9 f3 ^' v" S! W" p! x}8 \2 k; d, n: r2 y1 X
lefttime=setInterval("scrollmarquee()",20)
# }# b5 X) a5 g}
2 E7 z+ S5 l9 B/ v$ Owindow.onload=populate
* P/ R  g/ s+ \- L! E" k& |- U0 V  ]7 d" e( w
function scrollmarquee(){) _2 v+ x3 o# Y8 [8 {
if (iedom){) l5 ?; S) f- Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): f* A: m& [4 O  I. ]) v, m/ D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 ^8 V  f0 U5 b# w6 Xelse
" U% F8 d2 X# Fcross_marquee.style.left=marqueewidth+8% S5 n' j+ [  Q" r- i: Q0 ^  F

! ]# X! M7 H3 B9 E$ e& B}
" V4 c. c( x5 ~) Delse if (document.layers){9 D( v: Z3 y! Y% |
if (ns_marquee.left>(actualwidth*(-1)+8)), a1 x4 E! K  ~" H1 p
ns_marquee.left-=copyspeed% H1 D" E/ e6 c3 y7 {( C3 v5 P
else7 w7 d& c, n% i- a2 U' ^
ns_marquee.left=marqueewidth+8
5 ]7 e2 x3 k$ q7 A9 S0 z% X) k}
% r3 a# C( _& e& l$ D% [; }) x/ w}. R* L+ F7 J0 Q) `& m2 U
: S/ z/ v7 c! a9 X( I) w
if (iedom||document.layers){# s4 Q7 E( B0 G; h* J
with (document){: @0 L* K" U& E! T9 }  B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ Y0 H9 q- Q( P/ P9 Z
if (iedom){7 x& [0 x6 l) T. T5 y# k3 ~: V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 m4 @5 \9 P0 C/ N, Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ t3 b1 t+ U6 D! W; n. G# U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); f* b, Y2 H# |# u* c" t4 U# Q
write('</div>')
1 _1 J8 ^! P  N) e4 i  w}
  _2 R$ B, n, m0 k' _else if (document.layers){* G/ ?' s& S! D  [7 w7 f' K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 ?, Z+ ~" U3 X5 z; b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 E& ?3 k0 Z7 X4 m5 Uwrite('</ilayer>')
5 K% _: C2 ?& [" Q# v) i}6 v; {; ~+ W5 L) Q4 Z
document.write('</td></table>')8 L& N( `4 F( `  u
}
0 K7 @; w6 b0 D& }" z7 j9 ^}" N9 g! y, I( _6 G: r+ q
</script>

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