返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ `& |4 i# ^( ^- \+ Qvar marqueewidth=300
$ Y; N4 p+ g; V" F- w) K//高度
# d3 o) x" F) S; p7 [/ nvar marqueeheight=25
$ F1 s4 A/ S7 G; i" j//速度(1-10)
% j1 y: g' e4 @7 m6 Q/ qvar marqueespeed=39 G1 O) Q/ `- w/ R" g
//背景颜色: p9 @" o9 z. Z' t5 ~
var marqueebgcolor="#FFFFFF"% n2 D2 b, _" s$ R5 y
//是否能暂停 (0=no. 1=yes)?) o. {, x+ l( ~3 x) k0 P
var pauseit=1  `1 }% z& }5 P6 z% T& Q
$ x, x6 A6 t- C6 Y$ F5 o
//修改显示内容
& s# J7 u$ W# }) G& o4 ?8 |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 E( a# V: L( E+ X( N

! H& H9 a, Y+ b* @( M/ }# r% K( T' p: l) s
////下面不需改变////////////% I- O2 M+ l9 d% O* |) l" |

7 |0 P( R1 D4 W6 |var copyspeed=marqueespeed, D. Z; C0 w" s& ]9 m
var pausespeed=(pauseit==0)? copyspeed: 0
- T/ J4 U, O: h8 L% W! N+ uvar iedom=document.all||document.getElementById
+ L/ z/ c0 ?  S) K/ Aif (iedom)
, {2 p1 F/ I2 H: `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# m8 e7 c- |: Q7 X+ L3 _' n3 Jvar actualwidth=''
. Z8 f7 k' b! q+ `$ N6 L$ @var cross_marquee, ns_marquee
1 e' T% Y/ |+ L' N) w; H2 v" P4 z2 q# l0 [" J/ R, m8 s
function populate(){
& V. Z# I" t  B( Qif (iedom){9 S; l. Q5 V3 O- T' B' s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( y$ N2 |' s* vcross_marquee.style.left=marqueewidth+8
1 Y; u) C# U5 Ocross_marquee.innerHTML=marqueecontent: t/ E/ \4 W8 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 Z6 F* T7 o0 b% X; F. H}
+ f; a3 x  _! H0 }: i  W) Eelse if (document.layers){9 ]/ J' N) S) A5 l8 {  ?/ S( _. M
ns_marquee=document.ns_marquee.document.ns_marquee29 j3 ]" ~$ W" {, m! C2 e* R. Q
ns_marquee.left=marqueewidth+8
- @. Y0 m! |* j2 Uns_marquee.document.write(marqueecontent)% X; {! P  q6 F, P: ^1 W( m% e. N
ns_marquee.document.close()
' `5 }; @) `, }9 C7 G; \0 Zactualwidth=ns_marquee.document.width( F- W0 l# x6 V9 ~5 U
}
* H# ]! B% `  Q" S8 Ulefttime=setInterval("scrollmarquee()",20)
! b7 L1 C0 @5 s  f& g% B/ K8 \}
3 g4 _  a7 d8 A. swindow.onload=populate
2 R( E6 B3 h( y( S# X" K8 I* ?4 s' g: z1 z
function scrollmarquee(){
1 }8 F" g4 [! z6 C; Mif (iedom){
+ ]8 i1 S4 k. m, F( D1 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 B# U7 ]5 e5 E: R4 G0 X8 s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 J: W( d  n; _. u( h
else
6 u- p1 T7 W1 ]- j! H- vcross_marquee.style.left=marqueewidth+8
: p* w$ o9 {! x, u. N5 \
3 E( J8 g3 W$ ^+ o; f1 i* R4 V+ K}
. |' u- V1 H3 ~: Jelse if (document.layers){
& ~( d  f$ F# b; iif (ns_marquee.left>(actualwidth*(-1)+8))
+ b' b5 q" }. m6 U; r" E7 Qns_marquee.left-=copyspeed+ V( z+ n: H! W- N+ V% s3 T9 D" O
else" t- K  E9 J* }9 }5 b
ns_marquee.left=marqueewidth+8* {2 G# y' v' ]+ l9 B8 t: f9 _& ~
}; k2 n) }: k1 A; {  P" k! I' o
}  C' J9 t0 V& f0 v' B' q( {' u
4 I: o; Z, x, X; y( C
if (iedom||document.layers){
- c4 W$ o0 k; x4 Y# {/ r' bwith (document){1 r; T! w* r" w" t: \0 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& _. k/ G( o/ o7 v* X+ b" E9 @) s
if (iedom){7 v! v& |# g# `* k: I& ~& u& E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% ?* n  N/ H' S0 M$ R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! x: i4 _0 \" D1 d' ]" f2 w+ swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), S. ^$ ^( Z" ^0 R+ B
write('</div>')0 \$ ?' v3 L6 r3 k3 c
}
+ H! o- p. ~: S; [: oelse if (document.layers){0 q4 E6 u' c4 x" ~! K/ B) |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: P! m( {: e2 X% |& \& O" j; Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 g/ K- Y$ F' C0 _
write('</ilayer>')
9 S+ L( z: S6 E) u}
& G. o% @' l: s6 q" S4 t" ddocument.write('</td></table>')3 Q3 j8 D& M% r. T
}
6 @5 m2 ^# c6 z9 z7 ~}  Q( o5 R  I$ w5 \/ p& [! J( g
</script>

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