返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 i. b5 _9 N4 I; Wvar marqueewidth=300; o$ M- @, ?" T( S7 M, }$ j
//高度
9 j; e: c& X- b/ ovar marqueeheight=25
: K) H# |6 I  h8 _: R: |0 `- x8 O//速度(1-10)
6 Z  f' P" h' Qvar marqueespeed=3
' ~8 v/ z, ]  l//背景颜色: t6 G( i+ a9 T& I
var marqueebgcolor="#FFFFFF"+ I: s" |8 g+ O9 L, i+ z
//是否能暂停 (0=no. 1=yes)?) Y& g, y+ I1 E$ W+ h
var pauseit=1
% H6 t* C8 O  E
: q1 y: r4 {  n' X; _, H//修改显示内容
; N4 l% j  W$ s0 }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 u8 L6 x$ H5 B; q
6 u: B6 \# B6 _2 o$ G
2 N' j0 r+ E7 J/ C' y1 h4 C
////下面不需改变////////////
; t5 B* C/ i4 m: _, ?
$ X/ k. M) \# W2 Hvar copyspeed=marqueespeed
  E% O0 h; L  Rvar pausespeed=(pauseit==0)? copyspeed: 0( I* d7 L3 x, d: j2 `3 E' B
var iedom=document.all||document.getElementById
7 R/ _# Y- c: O, `2 ~if (iedom)7 c9 y! z" i$ w5 E  l3 ]6 p+ x+ J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 X2 J% d" _, e2 O& _
var actualwidth=''; h, A7 e; S9 r* w! \/ [
var cross_marquee, ns_marquee7 m% z& Q1 t5 {. q4 x9 A/ {7 Q
# d' X* m% ]+ z3 }
function populate(){  J7 S* D! ~8 \0 i4 A2 n9 D" s. M( O
if (iedom){$ ~  U- s% R* F4 l' K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- {; v$ V1 `0 `2 H# K
cross_marquee.style.left=marqueewidth+8
  j7 B* A! Q- x1 wcross_marquee.innerHTML=marqueecontent
2 _! d+ B  J: F: ^* Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: C* J" N: B* z2 \' S) _}$ T! m9 J8 V+ P) ?
else if (document.layers){
* n9 ?" {/ b+ c# |. [. R1 qns_marquee=document.ns_marquee.document.ns_marquee2
7 }( I* \5 H" O" q" a7 Xns_marquee.left=marqueewidth+8, a* s- y# G4 _" ?+ \$ w! e+ ?3 z
ns_marquee.document.write(marqueecontent)* X+ H4 B' p  j* o5 R
ns_marquee.document.close()' B0 o9 S+ Y+ S
actualwidth=ns_marquee.document.width
5 J0 o# t- C# ]" U" N. u}
+ k- E+ y% f  r$ klefttime=setInterval("scrollmarquee()",20)# w8 X2 |" u2 t7 P
}
3 _( M3 _+ z' Fwindow.onload=populate# N3 P2 M3 h. S1 F5 j5 v- I9 i
: k: T) ]4 q) b3 h) M  C. R
function scrollmarquee(){
  g1 y. N1 ]" lif (iedom){
" n2 ^; u0 O1 Q; W# A% tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. i7 O; S* A- G. X1 Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' M) ?4 i3 G0 K" f! G4 Z  A  aelse* Y  O6 V9 e- z2 r6 G
cross_marquee.style.left=marqueewidth+8
5 E- i% s1 S8 @+ L# [( {* \  K
6 f8 i+ c2 O) {! P4 @}
0 s9 @, J: A9 {5 r0 W# Ielse if (document.layers){
- u7 m7 `0 Q; q, {6 V$ [7 C7 H6 [if (ns_marquee.left>(actualwidth*(-1)+8))
( E( q: R- E" ens_marquee.left-=copyspeed) {( y: n1 L4 X5 d# @
else; L) R# I  e' ?& t
ns_marquee.left=marqueewidth+8
' i3 s( }# w( M1 t  _}
! ?  P) b9 R, F5 Q% V}
: [& y, e0 U6 K9 _
$ B1 j: {; w3 y% G( T0 u' Qif (iedom||document.layers){
# P2 u" d3 ~3 B" f2 H/ c" Awith (document){" V) P9 @  S9 V; U0 r- ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# ]5 R3 R1 k7 ]7 Bif (iedom){
5 \8 {2 f) l! c, m0 i3 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ [1 I; h9 x# p/ z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; [/ K! Z9 U2 @/ B% O& t+ u7 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& m* }1 p4 u" |4 }& e
write('</div>')2 |7 y$ ^6 x% b3 d2 v/ k
}
  X# l4 F) X& R# f6 U5 felse if (document.layers){
- s: x. l+ `3 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) P1 R2 w7 t  R4 ]7 P* O! twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* l% Q$ E4 i1 \+ m+ n
write('</ilayer>')
$ ~0 L, R5 X; T  y}
3 [8 m0 p- g* M  R& P8 b* Bdocument.write('</td></table>')) i3 G. W- T. p  [$ t
}
5 ]' F6 a8 K3 t; w}8 D9 Q7 c6 \  m3 X
</script>

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