返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 z1 E# d1 _9 @2 h3 bvar marqueewidth=300/ k# g" ?$ H5 C3 Y; Q" I
//高度
/ l  D* Q6 |& g# H' K! M  Cvar marqueeheight=25. e: C6 r5 z+ z3 n
//速度(1-10)
" @0 a9 v/ K! ^8 ^7 A/ wvar marqueespeed=3
7 o- r- r+ R, f- O. P//背景颜色) Y* O) E6 x0 V* e
var marqueebgcolor="#FFFFFF"% W9 g. I7 G( W8 y/ j( P& H
//是否能暂停 (0=no. 1=yes)?
" h. ^8 }3 Z/ `8 Dvar pauseit=1
! c8 Z, _  ?3 `# K7 ?( E, N
# [% ^. C) @4 J, q9 i//修改显示内容
7 b1 o2 x7 ]8 f+ R1 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': `) s) h4 ?% F1 m
3 N% L8 Z9 j7 j+ k. m& ~% M
0 I0 u# N2 s: c  o, o& Y
////下面不需改变////////////0 h; J0 v, H, H6 Y4 ]
0 o" r+ q! j! c! x
var copyspeed=marqueespeed
- U7 `- F4 H. V& nvar pausespeed=(pauseit==0)? copyspeed: 02 M, J8 ?' q6 u! q7 ~* L, G& C2 A
var iedom=document.all||document.getElementById
6 t% u+ x% j; U. k+ xif (iedom)
( z: n  W, S7 Y/ M& Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' E: `1 a2 {9 o" ~5 o- t) L+ fvar actualwidth=''
; V* v: [/ y8 Z% b" Fvar cross_marquee, ns_marquee
2 B1 Q8 W0 @+ \: E: c* c% T$ a, N7 Y3 K( c% C
function populate(){, m( {3 X- t: m! z+ _" `) A
if (iedom){3 p7 F+ {* b8 c4 z6 t' x2 k& g+ `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 y5 J9 n/ |! g& d# l5 \# S( a) C; U
cross_marquee.style.left=marqueewidth+87 d. _1 l6 u' E# }/ J. S
cross_marquee.innerHTML=marqueecontent
8 G6 R+ ^0 Y' {( g$ R0 lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& `8 N( Y& N" m9 w% |( G
}
. M0 T  j& d/ x/ u0 nelse if (document.layers){
5 F) o; |$ L- r! Ons_marquee=document.ns_marquee.document.ns_marquee2
7 p/ U4 p! o3 {ns_marquee.left=marqueewidth+8
, `' V' P; }  C4 R2 [% P) d" Sns_marquee.document.write(marqueecontent): E7 Z7 v1 Y! v2 s/ n( X- O
ns_marquee.document.close()6 d  O- J4 K+ x) A, v& |4 Y' [
actualwidth=ns_marquee.document.width
/ q* I7 @$ f, s  k" I  j}
! S8 t  q* `2 w4 z' p2 ?lefttime=setInterval("scrollmarquee()",20)
2 ~- L; X$ T7 q}
$ W# B* `# [, I7 `8 z4 uwindow.onload=populate
- r, {" o! T8 w. r2 h) R8 S1 k. `) M9 U2 _( G, n
function scrollmarquee(){
6 T; g% T1 i! oif (iedom){
* o, K1 u( X% V/ L# w6 T# R# @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 F( y8 Q' a: _5 Y! k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; E0 M$ W/ f  F, a  G
else* z3 J, i0 K" L  X8 Z" y0 e. D
cross_marquee.style.left=marqueewidth+8
+ N! J5 X4 l; I  ~. B" k( j$ I3 v. S9 S1 N) [( b, ^3 I# g! p) y
}
8 U5 ^! f: ]2 G% o" felse if (document.layers){
" m5 I8 w1 w& s" \  @' |) L- m3 iif (ns_marquee.left>(actualwidth*(-1)+8))
6 S# r3 q* U& {9 a$ Xns_marquee.left-=copyspeed
* `1 H% I! l- A$ R2 M5 ?; m% welse4 }/ g$ y( X) T2 P1 k3 o( @1 I
ns_marquee.left=marqueewidth+8
. P. M0 d- K. V( z}8 m% S$ x) ?6 X
}
9 r0 c2 E9 ?  z4 t. n; u% x& l" y( _+ S
if (iedom||document.layers){
. c# c5 U6 H; Bwith (document){3 O" e7 b! [4 I0 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, z8 Q0 E5 M$ @( b! L/ Gif (iedom){% m& w8 @9 p' [" ^0 ~* Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" w4 D. d7 N1 Q- G; m' z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) c; F  G; O# V3 U0 u# S+ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 U  P! B  h& k0 v$ l8 h5 `
write('</div>')
; g8 s* ?0 e1 w0 i}
- F3 w3 L5 o" l, R; ]else if (document.layers){2 m: @$ a0 z! R  E8 z3 C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 G/ ]* G7 n* b% X0 d$ ^$ n* s2 ]9 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& m. m& K0 S) k) g
write('</ilayer>')/ y0 Q4 H  h6 w# b+ r% D
}- E5 ~, Y* @! y8 W! M& }4 T
document.write('</td></table>')/ R7 n' e% ~- t. D
}
) g( ]) v" E2 O' ^1 k9 p}6 h/ e, V9 `) G( ?
</script>

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