返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ |1 S: c( G: s8 P9 X& |* Y
var marqueewidth=3000 C- Q3 v2 w1 }/ X  Y
//高度
* y1 q% u4 V. I4 z3 h+ tvar marqueeheight=25
" H+ V5 J1 Z- f, \- F4 v//速度(1-10)2 \8 V- Z: x  M  M
var marqueespeed=31 ^! y7 Y: [% M6 M7 {" Y& n
//背景颜色
& y  _) ]9 l# avar marqueebgcolor="#FFFFFF"
) }+ ?$ _8 p/ k//是否能暂停 (0=no. 1=yes)?
3 i+ e2 T0 g  o( m: W4 Vvar pauseit=1
  _' ?, F  I" j6 l7 z/ ^# p: K( B. Z( O! f- N
//修改显示内容' Y. x5 X/ C: A- Z- C7 v. R5 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. V( H5 ~' M, G6 x  m0 L3 _

" \& I- o7 S' v5 j4 s# [! K3 `6 ^! E6 H6 t5 V
////下面不需改变////////////( Y3 M; T* \2 A0 |9 B7 i- @0 ^' r

: h6 G5 I$ ^5 S) C8 fvar copyspeed=marqueespeed
: S2 C, s; Z& t) V5 }var pausespeed=(pauseit==0)? copyspeed: 0$ L' U+ r: P' t9 M
var iedom=document.all||document.getElementById, b# [5 X& p1 s$ f
if (iedom)
7 e  W! [/ W4 Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" Q: M$ x: s4 L/ a7 i$ s
var actualwidth=''
% u6 f" a- i  b+ A4 ^var cross_marquee, ns_marquee/ ?$ t4 T! ^3 \4 G& Y& ~# v

% s8 d6 K/ a( F' r5 R$ n9 z4 ^& ~function populate(){% @: J3 C) E. V# u! t7 D2 q, r
if (iedom){0 [) [* v/ H: ?2 l+ X) F4 T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 Y/ g& m7 F  q# C* a2 V" t% E! ccross_marquee.style.left=marqueewidth+8
, ~7 }( Y+ S, Pcross_marquee.innerHTML=marqueecontent/ Q& [$ d0 F  B  M+ |5 z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; E( e) g: o! {. }8 B
}4 p5 r1 f3 ]  U, y4 |, W
else if (document.layers){
% N/ J7 h: N* @7 Qns_marquee=document.ns_marquee.document.ns_marquee2+ J" k/ e5 l7 Q# V) ^
ns_marquee.left=marqueewidth+8
# N  [+ _4 z3 \% Gns_marquee.document.write(marqueecontent)- t; h/ d6 w. v3 w7 W
ns_marquee.document.close(): x; q  w4 t6 m& J/ g6 R
actualwidth=ns_marquee.document.width
- v- Z" W0 A2 W}
6 t* y( g& P! W3 Llefttime=setInterval("scrollmarquee()",20)
, {" w2 g1 Y8 Z; f. B  A/ Q- D}
# a0 k2 C+ U- Cwindow.onload=populate
+ G- p' ~. K' @" b
2 i1 p. K; C9 o* P3 M+ jfunction scrollmarquee(){
7 {- ~$ p, o) B3 q( yif (iedom){( b- ]7 y% C4 C3 U/ M3 f3 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' z: V! D( P8 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 Z6 b% [1 d3 B/ T
else
0 s/ a2 [; X& R  scross_marquee.style.left=marqueewidth+8! [( x: r4 B& g& U/ X9 o

, j$ w: D3 z0 A5 K7 n/ P5 w1 ^}
4 i( k$ T. M- O9 ], B- @( z  G& `& telse if (document.layers){
) c+ Y2 K2 Q$ Y# Jif (ns_marquee.left>(actualwidth*(-1)+8))5 y) e+ T7 H/ O- f" ]; G( y' a
ns_marquee.left-=copyspeed4 l% Z' W- K- H
else
* e) J9 I9 q4 Vns_marquee.left=marqueewidth+8. c; n6 g+ f' N& i% p& }
}% y/ f$ K* `, e" }3 d
}5 V( y4 i" n7 Q2 k  S
% m, t6 X: }  [$ p/ l9 Q7 z# w8 S
if (iedom||document.layers){! h5 U1 _) Q3 q+ |
with (document){
$ m8 l) [3 e5 \% \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 o0 Y. i! x. N& `, `3 g
if (iedom){
& B2 }9 [' b' U; b2 Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) Y* J3 |0 e2 X0 ]9 Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), S9 x* Q4 }4 y' B  n2 S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 c. d' @2 J* U6 L: awrite('</div>')& a7 C' p( f/ x
}
3 r. \& g7 Z. U/ Welse if (document.layers){
( v; M: w* e% X. A- [5 k# Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 N6 C* |6 }- e3 w. L% {; f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 I' z5 s, K; D5 S
write('</ilayer>')
1 u. V8 j+ Q$ \% b3 R3 q}
6 I/ r* G" D8 |- G6 ]. Z& bdocument.write('</td></table>')
* i. b" |1 H7 o  w; H}1 ]6 C2 [4 i; s8 K) v7 q
}6 \# b" R& N/ D0 D- N$ C
</script>

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