返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) x/ n& k$ |7 g" x  r7 [) j1 Gvar marqueewidth=300
) J: O- S+ e0 S8 C  g! ^# m8 v/ F//高度
8 T! l7 G0 F8 l% f$ vvar marqueeheight=25) A' X! d+ G2 F+ Z% `
//速度(1-10)! z. \- b. a7 b+ V( Z% Y$ ?9 J
var marqueespeed=3
! b4 I4 ~5 U2 z1 \0 B//背景颜色6 k7 e% Z" I) ]; W  y4 ]
var marqueebgcolor="#FFFFFF"7 j2 x, P4 [! `: P" c9 V
//是否能暂停 (0=no. 1=yes)?4 ]1 N/ R) F+ c& q$ n& S( p2 F  S
var pauseit=1
1 T7 ~+ N9 A0 w* P& ]/ p! Q
+ N" R0 N9 Q6 ^//修改显示内容. x! d. A- C- j0 v  }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: x8 r: \6 F6 [  @: R' Q2 [' ^. Y3 F6 F! N/ r6 E2 {& U

6 H( Y& w+ u2 O4 S5 w////下面不需改变////////////
& n& P  b) l9 H$ ^. t
0 k$ ^5 C0 }& X$ {" I& c0 Mvar copyspeed=marqueespeed
4 w/ V' e4 p+ @9 l# F, Cvar pausespeed=(pauseit==0)? copyspeed: 0
  G7 e3 h" k1 \; M$ E5 g$ D3 Gvar iedom=document.all||document.getElementById
% v$ ~3 E; R! d; y* r8 b$ O/ ]if (iedom)
- ^6 {1 |1 N" ~5 b  F2 D% E0 [6 Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); U, y+ L% D8 T. }  U) C
var actualwidth=''* A3 {' t4 \" i2 J
var cross_marquee, ns_marquee
' `0 U- H% e% y* [( L% X6 S
$ r+ v2 p- o2 U( Sfunction populate(){1 {3 l9 ?$ V. p$ j" |- u+ E
if (iedom){
1 \) [# t( }7 `, j9 }  Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" @( ]; n; {: A/ X$ X' C
cross_marquee.style.left=marqueewidth+8
4 ]1 n2 |1 l  `7 `' Pcross_marquee.innerHTML=marqueecontent
5 F; }" x1 i3 A* z6 g9 \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  E9 E" Y7 ?- ~" O" ]% L- q5 _}) g3 T7 _  L# t. u; {
else if (document.layers){
4 D/ O. D3 s$ W( i* gns_marquee=document.ns_marquee.document.ns_marquee2
6 g5 h4 T* R% Z6 ]5 M, c) B2 _2 Zns_marquee.left=marqueewidth+8- {( l5 D& x: p. ?( ?
ns_marquee.document.write(marqueecontent)
) a, {5 C: @( y. y1 e7 Xns_marquee.document.close()
3 @3 Y9 q! H7 A( C5 [3 _actualwidth=ns_marquee.document.width
' G; @% q0 E) t) ?}
# C# v: L( c4 C, _9 @$ alefttime=setInterval("scrollmarquee()",20)! o. @# Q3 `  }) }0 w
}9 h! o9 Q3 c  q) Z5 |
window.onload=populate
9 I" e% j8 _. `4 T
& j9 s" v, f6 \) P' y, l* j8 `function scrollmarquee(){4 S4 T9 k* `8 d  A' M5 @7 z) B
if (iedom){
$ Y9 ]5 _$ h' o4 _$ z3 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), c/ S# N% c! ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ p) l( R% e7 a7 n' g7 B& A. selse
2 S; O2 v  s1 b* B' Ucross_marquee.style.left=marqueewidth+8/ j$ ]: F6 Q& W5 e$ J

1 a; E' S) ?( K8 h/ J( |3 A}
- A1 c  n. I( _, S: Delse if (document.layers){! t2 W" g3 ~8 B& S; s* K2 g* X) b2 f
if (ns_marquee.left>(actualwidth*(-1)+8))
& ~. x; E4 [# ^ns_marquee.left-=copyspeed4 [7 P2 W$ @, z
else
& y0 ^  w5 l3 I4 V  Q( ~( `3 Lns_marquee.left=marqueewidth+8) \* d/ F: A- C' o. C$ D* Y: k
}( w' p* C9 U3 N" a
}* b) O5 |: l$ b

* l, ~0 y6 t  \5 C$ r  Zif (iedom||document.layers){: S/ w) B& X: s3 N' J  G: B# g  V
with (document){
$ A5 K4 @( W+ v1 a3 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& O' j  t# H4 ~( I; dif (iedom){
* p( b2 e0 {3 {  A3 I+ Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). \: t( T+ I3 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* Q3 X$ M7 a; T8 H! Y% a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' ~3 y" X4 z" @, T- }0 i* Lwrite('</div>')
1 \. s& i' `/ D- Q. Y% C. p( x}9 {. e* v  D9 Y6 L
else if (document.layers){
8 H7 S! X0 g# T! |( q0 u% Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. L: B' @2 B4 h' g4 o, X% R' k; Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* w* a! R7 a1 L5 [% Y
write('</ilayer>')
/ W) N. ]! z9 J}
& m2 t  O  Y* \8 f0 l6 Ndocument.write('</td></table>')
% @3 X2 H! }% w5 i& J}
% L" W. m# ^+ T}
4 S4 v3 I9 `+ q5 r</script>

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