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

网页之跑马灯文字特效

//修改宽度
- B) g5 M2 }# r2 fvar marqueewidth=300
4 x& M. O' d. }1 t* s0 C! }//高度
2 ~: [7 ~$ k4 b6 fvar marqueeheight=25
( v; S: ^& z! Q, }. u" u- R//速度(1-10)
! K# N$ C- R, Bvar marqueespeed=3
, V5 n7 H+ p5 c9 b$ w: M//背景颜色. J  {/ Y- t( j
var marqueebgcolor="#FFFFFF"5 p: I) s4 V/ v) N; A
//是否能暂停 (0=no. 1=yes)?
" K% t  [6 r1 W- j. }1 m+ L+ o8 xvar pauseit=1
$ k$ K- ?! }4 R7 W" j" y+ i$ |" \  N) k$ x
//修改显示内容
/ k5 H: M0 g5 B+ B# W1 l3 T) qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. H' S/ w/ D% @) J

0 P: J$ b) a- `
2 y* D8 v  k5 ]9 H; a  B4 H" J////下面不需改变////////////! j4 c7 W4 E4 T) J$ p
4 ]( ?, i9 q3 J! t
var copyspeed=marqueespeed
+ A& _! m* w+ k; c/ `6 j  Svar pausespeed=(pauseit==0)? copyspeed: 0
- d( T/ Z! y/ H$ V! N8 h% Uvar iedom=document.all||document.getElementById2 }7 n7 b6 B3 Z, A8 @- P. p
if (iedom)( @& \9 w9 t# H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 R  s, p+ `* gvar actualwidth=''/ h& t, g6 ~6 Z
var cross_marquee, ns_marquee
/ `+ z& E2 O$ A
( Q$ k  d( i. H3 T: d* cfunction populate(){
3 i+ b" J5 ?) v7 o/ \if (iedom){* f* k, t/ _9 M1 T) {- ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' A( F$ D4 O, [& L, |+ H% w9 ^3 Bcross_marquee.style.left=marqueewidth+8# q, Q+ o; y* n! N% ]+ y
cross_marquee.innerHTML=marqueecontent
  v/ F- F, i# G- c2 e9 p9 e& U( qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ y" X4 n6 S% ?: m! e, j}6 s6 N. ^7 g0 [. @; C  W
else if (document.layers){2 Z8 z( M8 H. h$ {: n
ns_marquee=document.ns_marquee.document.ns_marquee2
" m- Z1 \7 Z1 T2 |# W% Ans_marquee.left=marqueewidth+8: [  z/ A1 b1 s- f/ x" b4 _
ns_marquee.document.write(marqueecontent)
: H; C1 \- X* n/ _ns_marquee.document.close()
8 Y; l2 I2 q7 V, Eactualwidth=ns_marquee.document.width8 D  D; h7 ?  b7 b  [2 I+ U
}
0 d$ F# ^4 z: l0 ~! Vlefttime=setInterval("scrollmarquee()",20)
, O4 F) W3 J7 i# \$ t}
; A" u9 C7 B4 W7 p- l2 J4 @1 G$ b2 ewindow.onload=populate  S. V& z. Q( I! T% }

/ m$ j& H1 A: j; ofunction scrollmarquee(){) g+ b" M' o+ s4 D) z. y
if (iedom){
; B  W% R1 u+ ?* Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 m* p- g1 O- S2 }, a6 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& W: L& B# p: _% lelse. q9 K, @/ @' @
cross_marquee.style.left=marqueewidth+8
. j; i# L& B8 a3 t3 c6 v# d0 s6 ]2 u9 |+ @$ }
}
1 Q% ^+ d& k3 g& e. V- zelse if (document.layers){
& {7 l. b: d! H# R1 y  t' Rif (ns_marquee.left>(actualwidth*(-1)+8)), R$ j, q! ?, a, ?& l
ns_marquee.left-=copyspeed8 A$ [- V! K6 D! E2 b- `- V0 J
else3 F/ g. p' A- k% l+ s9 x
ns_marquee.left=marqueewidth+8) p' D! d9 J. v  z6 d2 p
}; w5 V4 X7 [" Z5 }, K
}
" k1 ]2 D0 V, ?: w. s8 G4 t) S* J6 t9 S
if (iedom||document.layers){, o1 P& L9 |1 d7 F
with (document){/ d& t6 i1 g9 i) [% A( L! @# x5 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 @' |/ h7 u. e  B; l" t  m5 {
if (iedom){
3 p  A# T, c9 h  ^: B2 a6 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& P, p; w: a/ e: I& R. K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 S; P+ ^$ t/ p' P/ \, E, owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ Y6 e% Q; a- \; a5 I- S8 Pwrite('</div>')' T' V$ q5 v+ X- W
}
; W, C- _* O0 X9 A* {" nelse if (document.layers){4 o! d3 k1 X6 K7 w+ S  Q' C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: o3 j9 w) j; S6 Z3 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# Y3 L% T/ z4 J2 awrite('</ilayer>')
' r# ~& Z# ?. `6 @. C( h9 I}
% m0 c% E) c6 Kdocument.write('</td></table>')
2 R, k1 {- i) _/ y% x2 M}8 D! u1 A- I( e- c4 O2 e) b
}" }) c" o* k! R3 X+ I+ K
</script>

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