返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  R, d9 d( d  }: c% _2 Wvar marqueewidth=300* w1 ^3 [/ C" _  M. C" N
//高度
" h; I( z8 ^( o. qvar marqueeheight=25
0 L3 B3 d, C0 V1 p" j" y//速度(1-10)# T& l2 n% b$ S8 a
var marqueespeed=3# m6 Q0 V2 X# W
//背景颜色
* x. ?5 F! [6 w& vvar marqueebgcolor="#FFFFFF"# t, ~" |, X* k; q& H# [
//是否能暂停 (0=no. 1=yes)?
+ f4 F3 o* S' C. D1 @$ g. w; Z- @+ C  rvar pauseit=1. Y/ `: Y2 \* M' \1 r; G& I& @5 B, s* L
$ v- N, ~$ c$ h; K- ~9 c
//修改显示内容  J( |7 z3 R+ h4 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" p4 q5 k5 Z! `

" M8 \8 H5 n) X, a2 u! l( U9 _. p7 T" S; q3 u: E6 h
////下面不需改变////////////$ L, |0 R- R. n! R. a
* X/ E; L- e3 C) p9 i4 Y( N% k6 r
var copyspeed=marqueespeed+ K: V* ]1 J8 \; X5 C3 X
var pausespeed=(pauseit==0)? copyspeed: 0
) x- K+ J  u& H: d% Pvar iedom=document.all||document.getElementById# s' Z8 c; W4 _/ B
if (iedom). u: z1 x: j( u5 u1 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 E! C: c0 z: g/ A* f+ p
var actualwidth=''
6 N! r$ |, R9 \9 pvar cross_marquee, ns_marquee
/ h. h6 q6 W- T$ j; j4 _+ O/ ?1 o# \6 X% a  [
function populate(){
6 A0 z+ G; @$ ^if (iedom){  }5 o4 l8 u/ q$ l/ C+ @" Z+ {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 V# [5 g7 l+ [7 _0 N5 W
cross_marquee.style.left=marqueewidth+8
# f$ L; |: K& n9 r( fcross_marquee.innerHTML=marqueecontent- F4 M% w/ E8 |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) @4 r" K+ M3 O1 ]1 ]# P
}
! |% e- t+ z3 ]  v8 y, B+ a& zelse if (document.layers){
/ N. m$ G0 Q* |0 T7 W' a: j4 ^ns_marquee=document.ns_marquee.document.ns_marquee29 z/ F, _; K6 m! ?" \. K
ns_marquee.left=marqueewidth+8
, M8 @+ b; c6 Wns_marquee.document.write(marqueecontent)- c, m* O7 K4 B5 D8 z! \% w
ns_marquee.document.close()
4 j5 G! L1 v9 }1 Y2 J7 R/ Mactualwidth=ns_marquee.document.width/ y+ y9 ~( M* o& y6 W
}: O$ I; F) S% J
lefttime=setInterval("scrollmarquee()",20)
) ^6 `, G9 [: {6 b}
) O6 |% @# R  m) pwindow.onload=populate6 S8 B8 y1 o! S4 G) }3 }+ e. l

5 l* u" y1 y$ x, \$ t/ @0 i, |4 jfunction scrollmarquee(){
. x& Y1 G: R: zif (iedom){
" e" ]# u  G; |3 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  c4 t# h9 z; m/ jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 Q% m/ U4 V+ X8 K
else" H+ i* b+ J, v1 d
cross_marquee.style.left=marqueewidth+8& E8 S3 d, z# r* Z! |& y6 l5 l
( A! r9 A8 |& v0 o! k3 U
}$ k0 J0 G& \! j) G% n- Q% O
else if (document.layers){) y9 H  q6 y% ^% }5 }2 Z. Q- k  y
if (ns_marquee.left>(actualwidth*(-1)+8))
  `9 R% o' q- H' V3 ins_marquee.left-=copyspeed
% m1 u" {$ h2 j6 o" kelse4 |: q; K" y# J; Z" F( J4 o
ns_marquee.left=marqueewidth+86 L( D3 T" }' F; J) G
}
  P' r, x4 y2 V1 ?}( {# \6 {0 {6 M% m9 a* R
" Y( v- ?$ j# u! S
if (iedom||document.layers){' Q8 o/ u/ }  v
with (document){' v$ s6 o) u  V! i% C! V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" l( i2 E, f! ~- Y  aif (iedom){& x( ?! @+ y3 @: U9 a) b2 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ V7 ~7 [2 {$ v4 x: }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% y4 r4 W0 u& rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 L# Y, T8 h: Vwrite('</div>')
4 ]2 {+ K6 V  l& b}' T$ H& {4 M3 h( E0 R. a  A
else if (document.layers){
7 M: ~4 y4 W1 fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( g. B% H8 D6 r- \* t& Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 H; G! G2 t" J* Q3 ~. f& e3 e5 N; v
write('</ilayer>')" `# ]$ S% K  x9 w
}
5 k+ W+ f: d( [! [) v# \9 b$ odocument.write('</td></table>')& s5 ^# K: S. t% u4 ~
}
" Y( }: l6 q7 Q$ _}
1 M0 i' ?; G- _1 M</script>

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