返回列表 发帖

网页之跑马灯文字特效

//修改宽度# p& \1 u1 D! Q" z4 S. _
var marqueewidth=300
& \5 d4 v7 K4 J/ n3 I/ l//高度5 T/ f) F) }% }% _
var marqueeheight=25
+ F) x: e4 X) Y3 C' F1 ?0 k//速度(1-10)
" n1 D9 r$ Y0 L9 Q  K3 J3 u; Yvar marqueespeed=3
. Q8 w7 G3 P5 \' W//背景颜色
  C  w6 |& N9 j3 f* M4 n% {var marqueebgcolor="#FFFFFF"0 e, ]% P4 y! t% G
//是否能暂停 (0=no. 1=yes)?$ J7 l& u! Y! t* S# M$ X
var pauseit=1
8 L4 j8 A! c! N
8 V" G- i  b1 g- d! D//修改显示内容( }7 }3 F- W" F9 J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 _: P3 @; [0 m+ y, i* \" j" D# o) Q1 m  W6 E
6 w9 S( p4 N# g1 c3 j1 g1 T
////下面不需改变////////////
5 `& J. w# z$ M
. j, X% u+ O. J* p: H: [# ?  |var copyspeed=marqueespeed
: ?. t* o( f" D9 T* I/ evar pausespeed=(pauseit==0)? copyspeed: 0! k1 x! O0 v1 c6 ^" x# T( ?
var iedom=document.all||document.getElementById
& C8 j- ^5 y  Y- Zif (iedom)6 y, K1 I0 Y! f! V, M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( p- M, t- c$ x: A
var actualwidth=''' g- C9 `* H6 K% |* Y3 j. g2 o' T9 Y$ B
var cross_marquee, ns_marquee
* G) G  V  z0 h0 U. d
  P% Q9 M. A$ Y" J6 o: ofunction populate(){2 F. G: d; b; V# [0 R8 ^
if (iedom){
! ]5 S- M2 t. r0 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' j: k% l( l9 {) R
cross_marquee.style.left=marqueewidth+8
  F" H, S" \& Y6 F' x  Jcross_marquee.innerHTML=marqueecontent
- w9 ?# @& z! ~, m7 M5 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: ^, V7 k- D; C
}
0 X3 e7 G4 p/ j! W6 telse if (document.layers){# L: o6 ]( B/ V+ ?& z8 C$ H; p
ns_marquee=document.ns_marquee.document.ns_marquee2! O5 ?1 k) [4 w& y# s. B
ns_marquee.left=marqueewidth+8
/ \$ ]) r( n# Zns_marquee.document.write(marqueecontent)
$ L% _. ~& j% g; I& K+ _+ x% nns_marquee.document.close()
" I" c+ w  n9 I( F  ?7 ?/ r8 K, factualwidth=ns_marquee.document.width
+ O2 {3 R  o# v0 z" j$ B}
2 N6 w5 h8 ~* ]lefttime=setInterval("scrollmarquee()",20)( b/ c! }: a" F9 g
}
2 y  p: E  {+ @window.onload=populate- Y3 D# S/ c: B, r) t/ O
0 R. |  h- S) R* Z/ k
function scrollmarquee(){
: r4 m& n# g3 ]# [& f+ r+ A& jif (iedom){  U* j; s+ K8 |. _, J' t' c) H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' I! @" m3 u& m" K: o5 J4 Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 e. D; U1 j5 W/ p" `# felse
% }' w2 A3 d  c* E$ ^3 Across_marquee.style.left=marqueewidth+83 Z/ l# d% r( D2 x7 e# j
. `- z8 J; |7 c1 Z% g# d& d( N4 g
}
% S9 J! C4 \# W( ]else if (document.layers){
  S& v9 Z0 f/ e; Q$ w$ T+ Tif (ns_marquee.left>(actualwidth*(-1)+8))
9 J2 Y& r6 @; P" ins_marquee.left-=copyspeed
" T4 X) Z  y& k) M" `else
5 Y/ K& E& {  Cns_marquee.left=marqueewidth+8
" {- Y3 t; ~" j}" B$ z8 F- o( {5 b! e! T+ \6 ^
}
8 S) [; S, o  Q7 _: c+ M8 F3 L; A2 O! M: v/ T
if (iedom||document.layers){
% x& Z2 C$ G2 _) i6 T8 Q8 gwith (document){
3 P) F- ^1 P6 l" I/ j9 R* adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* A3 p% p. q; s+ K0 z* n% jif (iedom){
& M" V8 ]; x; a- C0 s8 Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# L3 K( e" E! n- B. N0 J% |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ c8 ?" r! h: H7 H  O& p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( h" x  Q, m1 _$ {- K
write('</div>')" ?5 v! U% \5 Q9 `2 \$ R% e. ]
}
0 {" H" e9 b  Pelse if (document.layers){+ Z8 Q3 \$ @7 c: t( N+ |0 V+ ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 s- g) M% ^7 p. l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 `( |: o! G' w* q" S8 k
write('</ilayer>')
5 l) L- l$ H5 n: V7 S. K: y8 O}1 t% d# H) y/ T' O& A
document.write('</td></table>')# L+ L3 F3 ?! R$ U- j! i0 M. O
}
, c  v# \* d' z* g6 H! a, [}3 ?! y, e8 v0 a. E: W" B
</script>

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