返回列表 发帖

网页之跑马灯文字特效

//修改宽度, K3 B1 m" ~5 U" a) W  R- J) g
var marqueewidth=300
5 p7 {7 `  T& q0 ]8 b( f1 `//高度" P) u9 ]3 f+ V
var marqueeheight=25
- D# O! N! U7 Z//速度(1-10)3 \  I' y. l  a: W4 q/ g
var marqueespeed=3
- @7 r* B; U" V! g. e//背景颜色7 o* I- r: p' X
var marqueebgcolor="#FFFFFF"
$ g' {% P7 N: M% M) L: k//是否能暂停 (0=no. 1=yes)?3 s, B9 f( [, a5 Y' q& Z
var pauseit=19 h) Z; x: C0 ]" c
$ O& \4 C5 |' ?$ G+ g
//修改显示内容' ^- }; ]& _! r' l* n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! O3 B4 ]" O/ p3 `
) h, P9 O" t% Z, @

" P! u7 ^8 C6 i/ D////下面不需改变////////////& b! W4 \1 r9 S: A) ^0 ?$ g

; a3 ]5 p) M: ?7 J1 Zvar copyspeed=marqueespeed
9 D$ V- M/ X! m/ Q/ qvar pausespeed=(pauseit==0)? copyspeed: 06 @/ \* N8 H% ~
var iedom=document.all||document.getElementById0 R7 Y; c# j7 ?) x
if (iedom)8 d, s" ~4 v: V' b* K& x; F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# D+ n% K0 B' I' F6 Z) L% ovar actualwidth=''
7 h0 f. x: Y1 m2 C! m. jvar cross_marquee, ns_marquee
' ?' ]1 I8 c# I, y* d& ?8 T9 r8 d& i- k" W2 ^( _
function populate(){
/ e$ R5 [7 t2 ^2 C. }if (iedom){, a1 a2 d/ _1 r# M" j/ h! D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 s/ s; n4 s# H
cross_marquee.style.left=marqueewidth+8
7 ^1 X/ M1 D, e; N' y% f' D, Rcross_marquee.innerHTML=marqueecontent7 ]: g% ?1 E1 {+ Y; N- v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 b, ~) m6 _  z, n' i3 C6 ~
}6 n: B! i0 o3 [4 h9 Z) z; Z
else if (document.layers){
( z. M! U% \  e3 \ns_marquee=document.ns_marquee.document.ns_marquee24 m, j2 H: P  X# I
ns_marquee.left=marqueewidth+8) Y! p* n0 e. l9 b9 }
ns_marquee.document.write(marqueecontent)6 K- Y9 m4 h' a
ns_marquee.document.close()1 [/ F- P6 [3 V+ n* R1 f
actualwidth=ns_marquee.document.width
* k* x/ V; ~7 a! U  v0 K" K2 v# K}
, _  Y& d9 @3 f, x! c% @lefttime=setInterval("scrollmarquee()",20)! y2 e4 u/ v. q% J# F( ]
}
. S" z# ^$ v; L1 M' Pwindow.onload=populate( M  {* g$ h/ J0 D5 w! i
: ^# e- N/ ]7 q" z: G1 e9 N
function scrollmarquee(){
7 e, U* ]- \' h) d- \if (iedom){0 X5 a( o$ ?4 q: r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), x9 p+ Q' l5 U) L& a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" r: r: A8 u6 V* Helse
0 B  w8 n" x9 s: t( x7 ], |cross_marquee.style.left=marqueewidth+8
$ o' Q! b- w3 x1 L
! e% h' W8 E# Q7 M}2 z% z+ \* q+ [2 F3 X- h
else if (document.layers){: ^) K- w1 |: R1 `6 w2 C
if (ns_marquee.left>(actualwidth*(-1)+8))
+ T% d, I7 _) A2 l  Q6 W+ ins_marquee.left-=copyspeed' l0 O: t5 T& x" E: Z$ Q
else
/ M4 }$ h* A+ M- D6 v4 Z% {: ^ns_marquee.left=marqueewidth+8) u" w! B1 Z8 j* g0 d' }8 R
}
5 o3 X+ W, u6 Y! x}
  R  t" _+ D0 K1 P2 Y5 a! C" {8 W& ~4 Z) a, W& |  Y  u
if (iedom||document.layers){; i9 R! D+ v) x
with (document){
0 }! d( r5 d) V% e7 G. G* zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 z3 E" U/ i3 i8 U/ k  I" rif (iedom){
7 @$ g/ Q. ]6 B2 k( O- Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 o5 }$ W  i& F! b- I( ?1 Z3 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  y$ e$ g9 i5 B: }" b+ I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 F( `5 Y- T% S1 Qwrite('</div>'): M/ g% t; A3 y* L
}
3 Q' C9 ]- s/ y# Selse if (document.layers){
. C1 b# B/ [2 R8 o& T8 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). h3 q% e# y0 o) @" C, b0 l5 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* p( `. a+ L2 R! x4 ]# t6 P5 o
write('</ilayer>')1 X  P$ A% t* I8 a
}2 p* _* }9 ?" }- j# G6 K: y% p
document.write('</td></table>')& N. o9 V& Q4 H/ o0 N- E
}
. X% S8 j2 w; V4 U" @; y}
/ Y; f  I! c2 ^# I7 \</script>

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