返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ S( h$ q! ^* U* [9 \1 uvar marqueewidth=3008 H6 |  W" p" n$ I' q
//高度, V8 u6 E/ r% U! _/ h$ ?
var marqueeheight=25* y, D" H, R% j6 W
//速度(1-10)
2 V% W7 D1 U' f* y, yvar marqueespeed=3% j/ ~' n& T8 ]1 ?) ~( ~; `
//背景颜色! i9 z! A4 }7 `+ W* m% J8 {5 d/ Z
var marqueebgcolor="#FFFFFF"
0 K( q3 R6 @, J/ P6 U( G//是否能暂停 (0=no. 1=yes)?
% ]5 o- R5 _5 o: c$ lvar pauseit=1
7 E# \( p9 h9 M( N! u; e8 v0 @8 A! W! T) v) `% y7 N2 o% y$ y& i/ x
//修改显示内容
$ b2 F. s: u2 svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 J3 H5 u. h: \( a# J$ a2 J: S# c0 A" r: c: G- H6 q) A
8 E) z& b9 A( K9 w9 [, s
////下面不需改变////////////7 m- {. B# p: C5 G% f4 \4 ~$ o. z
6 W  V1 }0 [' l& [
var copyspeed=marqueespeed
7 r! R+ `& |6 \4 w/ I; gvar pausespeed=(pauseit==0)? copyspeed: 0+ U/ q6 k8 p0 @9 B$ L$ I0 r/ _
var iedom=document.all||document.getElementById8 ?1 v) G' [8 Z
if (iedom)+ p( A* C* ?# v) ~* q. e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% J8 U( }* P+ ^0 M# _& H: U) }
var actualwidth=''% m% c! J5 ^: t6 c5 J! z0 `7 U
var cross_marquee, ns_marquee
# y$ R; w* L/ o& g. O# ?# t  c( P" T0 H: x2 m3 N1 i
function populate(){7 K2 O5 r' u  T8 h/ o6 y& p
if (iedom){
9 e0 l$ n" g& q/ e  ^' xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: z) k/ H$ `8 d9 j- _cross_marquee.style.left=marqueewidth+8
: f. ]0 d* |7 C& P* u" ucross_marquee.innerHTML=marqueecontent
! i: }& D, l4 Q! {* }  W- Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 q7 X5 ?/ q- w* R! b
}" \4 l' r- j( ]! k, o8 M
else if (document.layers){
+ D4 }  ~. @$ v! m+ D6 qns_marquee=document.ns_marquee.document.ns_marquee2
2 j8 v+ K/ y) G" n5 Fns_marquee.left=marqueewidth+8. b$ j# B* f' U' l
ns_marquee.document.write(marqueecontent)( B0 X! G. e( E. |; W% r& e9 H
ns_marquee.document.close()
# p$ z7 o5 l* K3 vactualwidth=ns_marquee.document.width9 A5 K7 u- S1 E) k! {1 B, ~
}4 j" {3 @: {7 y6 F
lefttime=setInterval("scrollmarquee()",20)
+ m: {! H7 i& Y* `6 }% ~}
# B( h: s# y  ^4 O0 t9 C4 ?window.onload=populate3 b1 R7 S. [9 q9 d7 U
1 y3 D( w# [3 B2 _+ ]! J
function scrollmarquee(){
' s3 E: B- Y- F2 jif (iedom){
: c$ l$ N+ U( \& J. Q2 _* Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 M- M3 S" n- C% k1 t/ ?2 P2 K; Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% x4 M5 g& |! p5 g; g) z
else
. V" V+ Z9 c% g' a( M4 ?' `! vcross_marquee.style.left=marqueewidth+8& H; x; S/ e* I7 E  }! i0 L

1 D( |% D& w7 S2 u4 L9 @$ d6 s}* o4 j+ c- w& [* x: G% n: r% C
else if (document.layers){
$ a% X  `: T9 ]8 v  [4 nif (ns_marquee.left>(actualwidth*(-1)+8))
3 Z0 a" W  e2 p: C' U# T: Xns_marquee.left-=copyspeed
5 q5 b, g+ E7 I7 }else
9 v9 ]8 f  }  a0 k% I) ?( bns_marquee.left=marqueewidth+8! q- z5 b  f- o2 r+ y, \- z# t
}
% G# ~; S, s, P/ H6 ~# }% o}- D" s* u+ v0 `/ W; Z, y

" D: z6 v! Z2 Iif (iedom||document.layers){
9 O! J; o5 v; K1 vwith (document){7 P, i) A. t, k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 R* H8 Z4 y- Gif (iedom){3 P. s# U: U/ Q% f2 I, H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% R6 j$ H" D. C3 h; v; p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% [  V4 k3 `3 k- f* c1 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 V' ^4 d2 H  J' l6 uwrite('</div>')
; P5 U# N) n& M& P. A& [' d; u2 w}
& \* F8 h$ N6 N! Z" o9 A$ j& _" selse if (document.layers){$ h# ^  G2 U1 }# ^$ l6 ~- R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 k1 \) E! x2 ]! y8 O% {" uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 y+ u1 }2 _1 d/ t( \2 E
write('</ilayer>')( D2 a' q" H# k8 V+ W& l/ t
}
" [* W  k, W; u" V* q# k' _document.write('</td></table>')  }; L1 c/ V- ]0 s0 f$ {
}. t8 D5 ^4 g2 p3 `5 U5 F! r6 v
}. g  X& S# L7 t9 t: ^; `& g$ K
</script>

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