返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 W$ \' G6 ?0 S2 D/ z3 X: _& ?var marqueewidth=300
, o( Z" S/ j# m3 C//高度
  Q; l- a3 o9 Y" a' Y9 ivar marqueeheight=25. z3 ?" h) h( h
//速度(1-10). P# ?5 \- _, Q! W5 G2 b# I
var marqueespeed=3; C4 x9 O5 a  o9 |+ d, t/ [
//背景颜色
7 _; z- I' }, H/ k( j1 T- u/ R4 m* lvar marqueebgcolor="#FFFFFF"4 p  s. A$ i% N- _: |. X. [
//是否能暂停 (0=no. 1=yes)?
7 L9 a# H' w2 gvar pauseit=1, F5 x7 k+ B, k
/ E% w! i9 d4 l1 i! L* o8 E9 b
//修改显示内容, C( c+ N# \. p! w6 E/ P" I* V4 x/ L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- Y" D" Y1 s) y! Q$ ]

3 }+ a  P3 @5 D! Y5 ?# I5 g
+ r7 Z5 B2 Z6 [/ o; V% o' s////下面不需改变////////////1 L, ~$ f5 m1 O3 I% @1 `1 Q
/ e. l3 o- T0 ?+ U" ^2 d# u* \# q3 R
var copyspeed=marqueespeed
5 N7 Z( W2 \! ^; h; uvar pausespeed=(pauseit==0)? copyspeed: 02 A% w7 k6 M/ I4 p  B7 w
var iedom=document.all||document.getElementById" m8 l. l+ f' M1 r+ s. x  P8 A2 m0 w
if (iedom)' z0 f; L* G  t$ ?* L9 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 a: J# E/ `# z8 \var actualwidth=''
$ r8 c$ f+ ]- Q$ C* pvar cross_marquee, ns_marquee
  g7 u  [) c. l  k7 |: T% z) X7 n4 P' e; y9 J, X- E) w1 i# ?0 L5 q
function populate(){
6 _/ L* y. H4 Q$ Z- b5 Y- Iif (iedom){- v/ @8 g; \3 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ ]6 m7 {6 c; b- A% X
cross_marquee.style.left=marqueewidth+85 v7 Y/ s6 o" c% b  }7 b( L4 N6 f
cross_marquee.innerHTML=marqueecontent' a; |8 t' @  O! G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 T/ b% L; h" t( C, z$ v
}
' Q7 C1 O% ~2 L. velse if (document.layers){4 p3 D+ N, [; e8 U3 I
ns_marquee=document.ns_marquee.document.ns_marquee2( c; r5 u; g# b% G  L+ T
ns_marquee.left=marqueewidth+8: H4 O* E- K, g8 F
ns_marquee.document.write(marqueecontent)
, ]; d/ x% B  |# P  W( Dns_marquee.document.close()
& }0 {9 F$ l3 I, o; q5 Dactualwidth=ns_marquee.document.width# H4 n( h# t2 ]6 ]  }
}9 ?. U. C+ U+ C9 m4 k: D2 r: a$ Z, z
lefttime=setInterval("scrollmarquee()",20)
- G0 Y! l5 y7 Q- [: M) Z}9 e( y: n$ d9 T
window.onload=populate
+ r0 ?$ g+ Z, k4 z' e2 R8 O/ B# }! }
function scrollmarquee(){: S0 n9 R( x1 O
if (iedom){
7 a6 A8 K# G1 M- r' t, _% Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  q# e( M3 ~# n* a3 K5 r( k3 w2 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: }$ ]: M  l  Y$ ]/ G* V$ @else* B- e  T' }7 I2 C
cross_marquee.style.left=marqueewidth+8& ~2 |- W4 I5 a3 d( l
: ?: c4 G0 I, L
}
1 u; g  P' N# E- Q  V7 p/ aelse if (document.layers){3 }" s7 M; V7 I/ M* S5 y; k! ]0 F
if (ns_marquee.left>(actualwidth*(-1)+8))* a3 X( G* a& \
ns_marquee.left-=copyspeed/ ]+ u) g4 `$ g! t
else+ _, [$ T1 {, [" g
ns_marquee.left=marqueewidth+82 e0 e) W/ j9 C2 p% t" ~* r& G+ j
}/ x  o& u7 p( `: \5 j1 Y
}
5 P6 P$ ]0 x% A' D5 C4 m5 d* u1 m/ b8 a3 i
if (iedom||document.layers){
2 K2 W9 X" S% \4 }1 g" _8 Swith (document){) n* r" w) q+ D5 T3 [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% |- G! I. Q- x3 [if (iedom){
$ z. j" N# P5 p: B% m7 Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& m- P# T" N5 ?$ o4 I5 A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 [& @( L3 }1 w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- W  s& R; ~9 \' D' Kwrite('</div>')$ c4 s4 ]+ l# M$ s8 T! }* i; q
}
4 ^9 M! Z% L! H3 delse if (document.layers){
4 Q1 E! l: x; N8 D% S  w, L& pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' E9 G% {/ f' d2 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! r: k3 f; C5 T; g5 c: Hwrite('</ilayer>')3 U. g8 p. }5 E" E/ p) g
}" b) q7 X0 ~# Y9 Y$ F$ a
document.write('</td></table>')
- i' r1 R; J! U* D7 w}/ x0 }  Z$ t( D  a1 s/ N: \, |( v
}
* _. H: {3 T8 B6 c$ ?( o</script>

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