返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 Z# h# K) P/ |( L0 G% p7 v6 u
var marqueewidth=300% p+ f; W& k. t& e2 o) d
//高度* f  a. T; g) H) d) i' Y4 F
var marqueeheight=25$ l3 d$ N/ W; |1 |
//速度(1-10)" b$ W) h% b  j, s' o9 v: |$ v  N
var marqueespeed=3
9 r7 r: O9 z) p. q//背景颜色+ \% }, D- e0 s2 a; k
var marqueebgcolor="#FFFFFF"3 |$ X% O  ~  W/ H; s
//是否能暂停 (0=no. 1=yes)?
! Y, Z# b1 C8 y# Y+ W6 ~var pauseit=1. }" J" d; V$ v6 j

- Q$ j% q, T* l//修改显示内容, b  n( w# h2 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 F+ r* i  s; g5 }3 L: `
9 h7 S# b* i1 O, w1 e
% c' _* l( ?! S  E9 Z
////下面不需改变////////////9 ~- l- s0 X8 L' u( s% ]
' Y% ^; U8 D: _' n/ y6 O: K
var copyspeed=marqueespeed
( O  B6 A5 M$ u! e8 J; xvar pausespeed=(pauseit==0)? copyspeed: 0
8 Z7 T+ ^: i5 a7 }% P; f$ Svar iedom=document.all||document.getElementById
( W6 v! `6 J( e5 v8 Tif (iedom)
8 X( @* s- [: Z8 n/ J6 z7 A( h3 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- L0 w8 {4 R, T  M! O2 E( Rvar actualwidth=''
" L+ z# S' k2 G1 p8 L: `var cross_marquee, ns_marquee
: h9 I5 ~* a# o/ y1 K
. \! _+ }" u5 M. q# o1 X: l/ l9 Ffunction populate(){
! x' F5 a/ ], K( B0 m2 Aif (iedom){
  q5 A6 n6 I% b4 r# pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 k" ^3 Z9 i$ x, x4 {/ Gcross_marquee.style.left=marqueewidth+83 `! }4 m' D' Z( q( O
cross_marquee.innerHTML=marqueecontent
1 e! A" |0 e! S! factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% G" @/ N& p' E2 x& d2 U3 S5 V
}$ x! C+ V+ A) y- i* {6 l
else if (document.layers){5 U1 q! w1 o5 y3 u; Q
ns_marquee=document.ns_marquee.document.ns_marquee2% M1 h) T7 B: {# f
ns_marquee.left=marqueewidth+8
. i/ A- |. p( p! |. I) Cns_marquee.document.write(marqueecontent)2 ~& R' Q/ ^  p% q( b( M
ns_marquee.document.close()
0 r- ^! d8 G7 b9 o& ~actualwidth=ns_marquee.document.width/ p5 h* s8 _! k1 {% m% ~6 L
}
& p# C* L& w  ~* q2 `  plefttime=setInterval("scrollmarquee()",20)7 {/ O  Y8 J8 O7 T/ R
}
9 [0 b3 l$ ~6 a  E) S0 N" gwindow.onload=populate
. m* ^1 O; X1 ?4 W4 ^& O4 T: h' @- x+ {  _* Z; O  B. D7 ~
function scrollmarquee(){
; @! E0 d* V& x6 J  N* Xif (iedom){5 ~7 H  W( v% h! l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ U( i7 C+ D6 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 v  T: d, I6 C8 selse
& C- B  z' H% C- O: i' \cross_marquee.style.left=marqueewidth+8
9 _1 O( ?% f. [; t( M9 q' O3 ?% f+ Q4 n
}9 i( o9 s8 P3 Y) |, ~
else if (document.layers){$ c" r  A3 m8 |# F
if (ns_marquee.left>(actualwidth*(-1)+8))
9 }4 {: r: e! H+ x- H$ Nns_marquee.left-=copyspeed
5 |  T7 r8 w7 p" @9 Uelse
0 `. S8 y/ R9 Cns_marquee.left=marqueewidth+8( b9 v3 u, `* G* M; d+ ~3 V
}' E, [# D8 F2 f9 G$ m' B
}' K( p3 B( a( Y. J
9 O$ y3 Q  p" L7 R
if (iedom||document.layers){
5 R5 s& ?7 s# E) hwith (document){1 ^& m  ~' p% A- ]; s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 @+ F; H  F* n, Z# p& q0 C
if (iedom){
5 q4 t: n; \$ U- z, y" _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 l' H& v" C+ f" Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" C3 Y: U0 }. U* ~  w6 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); y) h- \/ m8 P0 \: A+ L
write('</div>')
7 ]2 ?7 m( E6 _% ]) g( @; S2 i}4 O0 c% O% H, ^! H, T" n
else if (document.layers){$ Z5 ?) E# q/ `" I* e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 l3 X* i7 T0 p) b& V) i" ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; y( T! F. D$ ?4 e) Mwrite('</ilayer>'): O. }! N6 H) ?2 n
}
* s( s! Z9 X% ^3 h) adocument.write('</td></table>')
1 d8 p. h1 ^: @}
3 j; a/ d' N4 Y( r}& U& {$ P) l: x% Y7 t( |) ]! Z
</script>

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