获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度) E5 A# ~0 y$ R6 j- G
var marqueewidth=300" l9 w3 N1 P+ O9 E4 ~. g
//高度4 |; I6 l) }5 G4 M' u9 H9 m
var marqueeheight=25- c/ `  M( [4 {, \6 x$ F0 ]0 ^
//速度(1-10)
+ L2 r0 x' w0 D& y- A+ Y% p) D( \4 @var marqueespeed=3- {7 n2 O0 S4 z( w4 I
//背景颜色6 s( A  }5 ~  c
var marqueebgcolor="#FFFFFF"
  N9 k, I6 Q  d//是否能暂停 (0=no. 1=yes)?# P4 z; z- Q( V4 R/ O+ H2 p
var pauseit=1: m. D, v2 A2 }2 W

5 j+ |/ w% i; \# h! K  j" w//修改显示内容$ t$ n0 }4 @9 [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 H+ F+ R4 f1 G) _( V( Y8 a3 j" Q! r# r# @8 }
, s0 T% l7 Q: X2 u
////下面不需改变////////////3 i7 U/ e. \$ U0 ^% {5 G+ F( E
4 g- t) l3 f$ X4 P
var copyspeed=marqueespeed0 u' ?. V) I& i5 f; B
var pausespeed=(pauseit==0)? copyspeed: 0: x, E9 t0 k% T- O  q3 G
var iedom=document.all||document.getElementById' ?7 Q4 o5 W/ n. G! m
if (iedom)
, z$ @# d7 j+ D( o  p! P  kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) B& v" c4 ]1 t0 U
var actualwidth=''* p+ c0 h! Z- n  W
var cross_marquee, ns_marquee
/ f: Q& P) i) ]; S& b
& C8 @; h( I& F1 z7 R. r! P3 R! Gfunction populate(){
9 z5 ?/ w. s: v6 e; ^& J7 Dif (iedom){" s3 F3 f. X# @' L1 a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ l  q' {4 P0 G+ w$ Y
cross_marquee.style.left=marqueewidth+8( c% |) h, G6 K5 ]; a$ J
cross_marquee.innerHTML=marqueecontent  O: D! H" P7 y; |4 M) p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- G$ n  k$ [  ^9 c, y; |, [. I
}" L2 I0 ~, _) `  A6 Q
else if (document.layers){* z' o$ W7 K7 I* @: d) Q
ns_marquee=document.ns_marquee.document.ns_marquee2
* s9 O" W' P- F$ G/ ons_marquee.left=marqueewidth+8' n- N8 u- k+ X* [/ Z( O9 s9 d
ns_marquee.document.write(marqueecontent)  D" {: }5 ]9 j: y$ m
ns_marquee.document.close()$ m- J  h' L8 Q3 b0 j
actualwidth=ns_marquee.document.width
  m- b8 S. t: z; d& h$ N3 S}; H" x( S" F% N! h$ @
lefttime=setInterval("scrollmarquee()",20)
2 A, C( ?- _6 X}
# c- j( m2 x, T2 X5 D3 lwindow.onload=populate) X7 c. _" v7 s( U  ~4 ?
* d7 ?0 A3 ^1 @5 G+ x
function scrollmarquee(){& y2 N, X/ k- |) w1 L8 t8 |' T" G
if (iedom){' [3 }; r7 m0 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 t  r4 a, v5 m3 O: e; ~2 V1 across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 T3 c+ y- S" Z% @* j' T" Oelse: _4 V6 k( Z& L4 `' D* j
cross_marquee.style.left=marqueewidth+86 ]2 K4 D2 B7 O! x1 T
: ^% U4 y) r% p6 Q
}
4 w- f% x5 z' V# c& p. O; j9 {else if (document.layers){
+ s' C& K9 a" d: @5 _if (ns_marquee.left>(actualwidth*(-1)+8))
/ L# r& `; `( o: A" vns_marquee.left-=copyspeed
1 ]6 p# L+ C9 c' _% d' h7 qelse
. a! }! u6 x9 k, k' Ons_marquee.left=marqueewidth+8
8 o) O# U1 I! ^' o7 b( [}3 F! y5 T+ T) k
}& N" L: ^) L+ k" Q3 H& F

3 C' o; i5 U8 Pif (iedom||document.layers){+ d& `: L8 s, i) ^7 z5 J- R
with (document){% \. `# L8 J5 d( o. k( o* _2 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 s8 ?% j. _7 S7 a5 Y. @8 j3 q: @8 k
if (iedom){
# o( U5 a7 w) a3 G; `7 n2 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). d7 X# p) q! [- |# c) z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: E0 h, _- _& m( e+ h: r' lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ Z+ R- o6 @% Y  D! e) G' C
write('</div>')8 Z0 [& D" l+ o7 _
}) V/ K! E' A+ a# y
else if (document.layers){
4 ~- V# [" }  x2 A: cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), F0 z/ _$ f5 h! |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* K8 M0 O" X: Z8 J! W! Swrite('</ilayer>')" H# {; ?# M0 j0 `: s
}
. A$ t1 u% d" c: x. F" Ndocument.write('</td></table>')0 p5 I) x2 W& v
}
* t0 u" n7 W5 N2 G# g8 j/ s1 ^}3 i/ k6 `2 S1 h0 U, T0 n
</script>

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