返回列表 发帖

网页之跑马灯文字特效

//修改宽度! K* z8 k5 U7 C& d/ J( c8 V3 @6 N% e
var marqueewidth=300! R! g/ z9 r6 `1 M3 l  X+ n
//高度
, n. Z) b  G! ^  i8 \) Pvar marqueeheight=25  k# t( r  z5 ]
//速度(1-10)! ~* u- c! O2 ]( C3 ~
var marqueespeed=3% ?$ U: g/ c: R% Z
//背景颜色: u# x! y+ E4 a$ q$ N  h$ s) j8 z
var marqueebgcolor="#FFFFFF"
% ?9 Y/ q" `  h' M//是否能暂停 (0=no. 1=yes)?
6 j& a  N4 ^8 @  j$ Y) j* dvar pauseit=1
+ P# }  G& W  H! e* ]( z5 y+ X& W  Q- \: v
//修改显示内容
" A) h4 J8 A! S% [* |; i! Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ t6 t2 I9 N% e/ m  P1 b& i2 C

) ^& M5 x6 H6 p( l9 P
4 D9 A/ ]5 D$ f% u8 k////下面不需改变////////////- D2 F& L$ u2 U; f( v+ y

$ m2 ~! B* q  A+ Jvar copyspeed=marqueespeed3 x' \4 I/ W% O4 N8 G$ D0 E* ?
var pausespeed=(pauseit==0)? copyspeed: 0( n+ g1 d" `) M& u% U1 |
var iedom=document.all||document.getElementById- ~$ p7 o4 J7 ?% J- O5 g
if (iedom)/ y/ B) q& w6 ~. r1 g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 K* |) p" w2 c+ z7 K! Dvar actualwidth=''0 C6 y: P+ y5 m* v
var cross_marquee, ns_marquee8 b8 l: f$ ^' {4 B# S

- O1 I# I) A  y6 [5 }5 \function populate(){
$ ]8 m2 i' u7 u+ V4 Mif (iedom){+ ]; o1 |* u& V2 b5 G  E4 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 d- n# m2 f; ~# f
cross_marquee.style.left=marqueewidth+8
0 y+ `0 A9 G3 ~7 H8 a; Across_marquee.innerHTML=marqueecontent
& T# s3 q) Y( m1 W# Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- m8 F3 {7 `, Z% q" A& f* s6 {}
5 M' u. w# M# A8 [else if (document.layers){9 A! x4 ]3 j* R8 V& f, d" E& ?
ns_marquee=document.ns_marquee.document.ns_marquee2( L# ?0 Y: S$ D- X3 l, x2 [
ns_marquee.left=marqueewidth+8
' a6 a* r6 b( {7 kns_marquee.document.write(marqueecontent)
, o$ |' O2 p9 ^/ ]7 K% W* v9 B0 nns_marquee.document.close()4 _% v2 {: p. I* @2 [% E
actualwidth=ns_marquee.document.width3 J0 f6 f( n: n9 r
}1 e5 M3 C  o% s
lefttime=setInterval("scrollmarquee()",20)$ y. m/ _! h' c1 U+ e
}" L& K% p$ A7 a1 g* o0 L! \
window.onload=populate' e: l( @1 w: L- O, N" w

0 Z/ z8 h1 h/ v6 w. ~, I, Pfunction scrollmarquee(){3 A  B/ B( Z6 h+ ?2 D4 n$ q5 w2 n! _
if (iedom){+ M% d+ f: C4 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 @3 a. y2 P' L, ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* F7 W5 z/ e7 D4 U3 Uelse; Y# y; o/ K# o6 t1 ]/ Q) L
cross_marquee.style.left=marqueewidth+8
: n- Q6 Q3 e9 H6 p/ k) k# X
& Y& ]3 S( |$ R2 C  c}
& J' ?! [, R9 M# U1 delse if (document.layers){
1 S8 k: Z$ t! Hif (ns_marquee.left>(actualwidth*(-1)+8))
5 G* e$ `1 d% X7 @ns_marquee.left-=copyspeed
  l% ?# x% c1 W5 r  @: j6 qelse# y, R) k* }, K" b) s. s
ns_marquee.left=marqueewidth+83 @6 t( p6 x" G
}
' L$ q1 n6 E3 M, f  K}
& Z  A3 |+ J" M" P
  d- ~  ]/ D5 ]+ s6 Hif (iedom||document.layers){
1 a& F( J, f$ L2 p8 x; |0 Vwith (document){. d* V3 k4 b5 c1 ?/ T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  Y/ J; g  f$ ]. R. ?
if (iedom){
7 `+ w, o2 c1 F6 d- pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& m2 |+ U1 G1 C% Z. G0 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& r+ F. D4 z) e/ |- z6 P$ e8 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) l  o4 p: [, {& W* ?  `) m) ewrite('</div>')
4 @8 n* k# T0 N! H. X}
- p3 B( ?1 U2 w9 celse if (document.layers){
- z9 \- z" C0 [# \2 ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ l9 F1 ~. P. V" b. x% ]' y3 k0 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 p0 e. i# x6 H% j! A6 E9 Fwrite('</ilayer>')
8 g- W$ C  L2 ]2 D5 g. I}
! D$ r8 a2 ?& V: x& v( Idocument.write('</td></table>')
4 @2 z* ?5 l3 N5 L}( C5 ?$ x7 V+ e
}
( n% d  P; G& e* m6 d: i/ q</script>

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