返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 ^. {9 Y/ y4 f; F
var marqueewidth=300# ?7 a( R" O% V9 C2 F- F# `
//高度7 }* ?3 C0 H% `; d9 Y  \3 d$ H: U7 B
var marqueeheight=25
! m% D8 ~  z) q5 j$ k( N//速度(1-10)# x( o+ g, X, J8 p& x
var marqueespeed=3+ U1 v! c4 e1 Z
//背景颜色
0 n! [9 J2 e/ w) o% Evar marqueebgcolor="#FFFFFF"
7 |3 N. d. u- ]7 n6 q$ n//是否能暂停 (0=no. 1=yes)?1 I6 @- }* j" Y0 l2 h9 J
var pauseit=1
( ~: W; {4 Y) ~' K" r8 [5 g* N, s5 w  B2 V
//修改显示内容
# a" _* d" E! b  Q0 q2 N9 D  f! Y; wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 R5 v- M% i. h. _; A$ r0 [7 @# U% f& H/ U6 `  l! D1 L

7 h, K1 }) Q, F////下面不需改变////////////7 l2 Y% o, R+ {  h( ?  ]/ F
& `$ u, K2 ]& A4 d
var copyspeed=marqueespeed- G# f1 h' \) m* B) D6 N/ N
var pausespeed=(pauseit==0)? copyspeed: 0
" d/ p8 k5 {- Mvar iedom=document.all||document.getElementById# p; K5 ^' q, ~. X- }, I
if (iedom). e* i3 @) P: N# P9 R) T( Q2 V* H8 O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ n, \  {; Z8 o0 g8 x* t
var actualwidth=''% l; S# }0 H! S9 I% {% u8 j* w
var cross_marquee, ns_marquee
# |4 ^. [! b8 N$ j4 n7 d. X5 _/ b( H) l5 \' F
function populate(){
8 l" x$ z% R8 v) H& u. Dif (iedom){
* R( b# J% k! N9 S' U, ^1 f0 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 R# _, T) h. S0 v$ c" M9 n
cross_marquee.style.left=marqueewidth+8
, k5 t* o6 x( `5 G" R3 across_marquee.innerHTML=marqueecontent
7 a( R+ l. g; t9 E, Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( J) ^! Q* S3 V4 I3 K5 Q3 M
}
+ f" w! ^" T+ r6 Lelse if (document.layers){
" |% o, }: I* C" X4 a9 N* lns_marquee=document.ns_marquee.document.ns_marquee2
0 L2 r  S% u+ s) C: uns_marquee.left=marqueewidth+8& }! e/ s* C+ ^& z$ `3 \# h4 n
ns_marquee.document.write(marqueecontent)4 i/ ~9 |$ @+ L% o
ns_marquee.document.close()
# B* j! f0 a: Dactualwidth=ns_marquee.document.width
# o* O3 v" Z2 o  h0 N* }/ r  R}
* a* b0 L) c9 a8 W8 Clefttime=setInterval("scrollmarquee()",20)- z7 E' t" t  q1 e. Z
}
" Q& s7 W/ t) Q* M( |8 u5 Ewindow.onload=populate7 C) S- d* Q5 l( k- i1 |  N7 p& ~- i3 t* H
( `3 f7 Q3 n4 ]& V) ?+ _+ a5 P
function scrollmarquee(){
9 v$ v+ i! j& ?2 \if (iedom){
# z  Z! C2 b* u9 a. U+ wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" o7 R& S7 I& _. V8 ]9 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ N5 }4 C/ s1 U) T
else
8 V' i1 E" T/ S' \1 }9 ecross_marquee.style.left=marqueewidth+88 k% x9 m% z4 @
4 X. V0 D2 x( s1 V' I
}
2 X( w# _7 C( S$ \. T6 r/ H, kelse if (document.layers){; k' C! M* T2 p, Z
if (ns_marquee.left>(actualwidth*(-1)+8))6 Y1 @7 G# [9 o+ G0 H
ns_marquee.left-=copyspeed
, g, R" V$ J( d$ z3 Y( U4 l2 oelse/ i) @* }2 s6 h6 P
ns_marquee.left=marqueewidth+82 N, e! q6 X. p9 t) b
}
% k. P1 l/ U9 G$ ?}! U( Y- \% A8 l. I# j5 R
7 M! }  d9 f2 k* O- }% U
if (iedom||document.layers){( N5 w& m; K- r8 G, {( o1 A
with (document){
( U3 @% w% b/ Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" k/ a! h' d/ _( A  I: X1 Tif (iedom){6 K( P( w# j* C' ^  t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 k0 C2 ]7 ~* E  j+ _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 P+ B9 e( F6 q% Y: T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" [( P# S6 E& J# s
write('</div>')" n3 M8 z( n* Y* e7 o; d
}4 u0 ^6 @, x- N, W( N5 f
else if (document.layers){/ G# A; T5 F! C: j5 H) |4 i! e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); L. F. }( J- n1 c! o( L$ R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ J1 W* ], w) zwrite('</ilayer>')
0 W7 |5 X5 y9 A% u6 @# a}
# \7 n2 @1 Y9 H. a. q/ J: W! {document.write('</td></table>')
6 b$ ^* p9 G( [( m6 R}
( j( g; C2 b& E( b$ `9 n9 n9 m}# h( D  D" k' b
</script>

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