返回列表 发帖

网页之跑马灯文字特效

//修改宽度! R$ g0 Q( A. n4 u' _$ w! @7 x0 |
var marqueewidth=300. v/ e- }8 P1 r" I: G; ~6 h0 }0 ?
//高度
% E( u, o. b& M7 hvar marqueeheight=25
* E! p9 Y! D; _' m) J//速度(1-10)$ ]3 ?9 ^- v, O: E: v- b
var marqueespeed=3$ h4 s; }! F3 @3 k
//背景颜色
) U; Q/ r4 F+ }: ~: Fvar marqueebgcolor="#FFFFFF"8 ~! k# q# b, d* {( \" z
//是否能暂停 (0=no. 1=yes)?
7 Y7 P+ |9 O, E; c3 u# pvar pauseit=1$ E+ c; u; q! N$ ^: H' J
2 V4 P0 S! \, R
//修改显示内容
7 h0 T7 |- s5 g$ ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 \6 K3 p! k  T5 k5 O- w! P/ \* q
6 l  D8 {  v. ^) Y' @0 t
. C4 Q9 B7 @  H+ ^# F3 e////下面不需改变////////////' m4 ]( s8 ?2 ^" e0 Z/ R9 |
1 D  i5 j( c' }' F; P$ J
var copyspeed=marqueespeed
( I1 O+ ]0 W4 ^var pausespeed=(pauseit==0)? copyspeed: 0
$ X, H' [9 @& z3 F+ w$ ivar iedom=document.all||document.getElementById
9 I  a; H# s# ~if (iedom)
. \8 Z6 U" O2 V3 N% U, ^: P4 N. cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) O! l5 \2 ]+ Q6 m$ m( `var actualwidth=''
  i% |% Y+ J' G: q5 ivar cross_marquee, ns_marquee
. f7 W! t6 ~3 H8 H
6 d. O& H6 I/ q5 Lfunction populate(){: c/ B, ?% x* A$ l2 k, O
if (iedom){5 J) g2 [. e8 R8 `$ i$ r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 @! O, B& t% M) m; y8 P  m
cross_marquee.style.left=marqueewidth+8
7 H/ R7 I' P0 ]; H* k2 Xcross_marquee.innerHTML=marqueecontent
6 o7 _( T. `2 ^: ^5 q3 vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 t: N# U- V: O2 D6 K2 w- w
}) S4 _/ U2 a& P6 U
else if (document.layers){
& R$ m1 N& `3 T6 t- y- c  q8 _ns_marquee=document.ns_marquee.document.ns_marquee2
/ c1 e/ c2 g' @7 H* Ons_marquee.left=marqueewidth+8
8 {1 S- U" i4 zns_marquee.document.write(marqueecontent)  n$ j& c0 B1 j! Z4 j0 P) Q, B. l
ns_marquee.document.close()
: j0 A/ K6 J$ W4 n  A2 q7 R. ?' z0 gactualwidth=ns_marquee.document.width
6 m3 \2 R! ?: [# O* L8 S4 a}8 b) w& H: i. \. V
lefttime=setInterval("scrollmarquee()",20)
! b, B/ E; G) W) J9 ]}, c" U8 X! A; V; Z3 G( t: l
window.onload=populate1 |6 _/ z- R! A" b  P# I% ~
2 r7 m: V& ?* O6 A+ |/ H0 Z0 K
function scrollmarquee(){
/ E& b' z7 u- @if (iedom){$ c  F! g! }; n) ]2 q  S9 u8 ~: R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' z& ]4 _: y" _% Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 W4 F/ z- |/ F2 |else6 c) F8 ]4 k. J
cross_marquee.style.left=marqueewidth+8& ]4 b  n( Z1 V4 p8 c0 N9 w
5 E& [- j. W% L' K# D
}" w5 s: T( M( w
else if (document.layers){9 i* q4 W. A: K1 g. g
if (ns_marquee.left>(actualwidth*(-1)+8))7 l+ r6 u! q! L
ns_marquee.left-=copyspeed
$ X+ q- {/ t( j$ Q% @3 Oelse4 E# ?8 j2 M5 X. D* @
ns_marquee.left=marqueewidth+85 Z- d8 x: t$ _4 t7 n
}
+ W% D6 E, S. `5 T, y6 T}
# I0 `* N  S4 B  A) S5 z! T' [* Z' ]4 {0 }0 D
if (iedom||document.layers){* ]2 ]) ]' w' T/ J& @- k
with (document){
' l- r% ]( U/ ^" D$ mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, y) N7 g) d( N+ f3 qif (iedom){# X% s1 o5 w3 i/ e/ L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): L, {/ O- o# g; o% N9 P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 V! c# _1 v. f, Q. \; D5 x* Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ Z5 k7 k$ J! |3 M
write('</div>')
6 J, M1 M0 ~) K/ t}/ ?7 A) v" I# ~/ d8 v
else if (document.layers){+ W) Z% n& P* ~; k6 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 G; A* n) H& T/ r/ z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): l2 r' @+ f  V  _' Z1 q0 W
write('</ilayer>')0 i" [! b$ {; X$ z
}
7 F2 |2 Y# ~! P. T5 D& ydocument.write('</td></table>')- T& e; q) p, t
}
# w; N( j1 X, y* J}" v$ p% b) W& f% G# m1 ?
</script>

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