返回列表 发帖

网页之跑马灯文字特效

//修改宽度: v- E) d( b/ C
var marqueewidth=300  ?+ ]' `+ d+ V$ O. k# A% P
//高度
6 Z9 i! G7 d& F5 l" q& i. \var marqueeheight=25( w, V$ t7 P6 |! A$ F+ l
//速度(1-10); `7 w* u: U1 ^  j# e7 L
var marqueespeed=3
% o; C4 C! l2 m* n% q//背景颜色
- t7 k) C* K& v2 [" q  g; \' |var marqueebgcolor="#FFFFFF"- F9 g: q7 N3 J+ h8 j
//是否能暂停 (0=no. 1=yes)?
& w5 w% F+ ?* f' H6 fvar pauseit=1
5 o1 W9 Z' y4 ]  a/ e" e; K* f  F: ~
//修改显示内容$ U( }. i5 U: j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': E9 y4 B. u% z
" g- l$ p$ V- Q* c6 }
6 {" n' M$ ]# _5 v
////下面不需改变////////////) w3 T# o2 ~$ o/ [

! R) D& {) g1 r4 [var copyspeed=marqueespeed
0 l& i* Q2 F0 z  c8 ]2 jvar pausespeed=(pauseit==0)? copyspeed: 0% a3 R. R+ y- R; v
var iedom=document.all||document.getElementById, E" r0 A, J. u- N" F
if (iedom)
- X) q' R: i2 k0 [/ {6 udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 d. W1 [4 H: r: d" @& ?9 U1 ?var actualwidth=''
, q% p$ S8 M% z/ M" u* g7 T$ R; W' Ovar cross_marquee, ns_marquee
1 R  r" p# A' w- S* z* K3 ^$ P& ^, `& y( j7 u9 M
function populate(){9 f9 q+ P3 ~6 w, a7 X" t" ^% I5 l
if (iedom){2 C* ]2 |* d- E4 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 p/ U) Z9 x: ?* S: G( b( N
cross_marquee.style.left=marqueewidth+8
, {9 @  r, I* S& Across_marquee.innerHTML=marqueecontent0 |- M% [5 i1 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ G4 t1 I( @0 [- }
}
+ U) U8 j/ Q# aelse if (document.layers){
' I' n, y* Q' A! f, K( X, ~ns_marquee=document.ns_marquee.document.ns_marquee2/ ~/ ^0 r3 v" H4 c) V
ns_marquee.left=marqueewidth+87 f8 U$ E0 E7 I% }: h. M/ f3 M
ns_marquee.document.write(marqueecontent)  D  }# W. [0 N: z) W1 ?
ns_marquee.document.close()- u+ ^8 s/ }4 T! c$ D; p
actualwidth=ns_marquee.document.width
7 z4 L2 [. h8 X! h' g9 `$ ?}
" G. y: w! S! n- vlefttime=setInterval("scrollmarquee()",20)3 P8 C) k5 E! S& u, [) G5 I
}+ e' \5 {) `8 L1 q
window.onload=populate
6 _3 d+ d6 }7 P7 k( i) A( N5 s9 W/ T, G- }$ S- V7 _
function scrollmarquee(){
0 q9 Z: Z; f: U7 q' Y# @: pif (iedom){, l) o2 R6 v( T: ]5 c. o; |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ c; A1 \! {# h% _' w3 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% O5 }, d% J8 V7 {* ?% lelse
# a9 l  ~5 H- t% ^# U9 F* I3 f7 }cross_marquee.style.left=marqueewidth+82 O( a. w4 G! L! H
( I1 d1 f' L' M9 n  s/ z
}
2 D: W9 p4 R3 Z3 q! M- Yelse if (document.layers){
! M& q* i7 ?* q$ W+ I- @4 i* b- [3 Hif (ns_marquee.left>(actualwidth*(-1)+8))
$ m) o5 X! m' N$ K4 O& B! fns_marquee.left-=copyspeed
, L( D3 W- `3 j5 eelse* A& k! Q/ x2 {+ U
ns_marquee.left=marqueewidth+8
6 w' e+ W9 f. A. o, X}
7 V7 `5 {; A- n% G' j1 `}
& w0 j  s- F4 f* o' g
2 U& u& h8 E- H/ O) r* pif (iedom||document.layers){+ K: T  t1 `1 C2 m
with (document){5 W7 Z+ D3 o' Q, A( f6 r3 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" E+ |' z; q$ C  G5 t
if (iedom){
; X- \2 p- |1 K% r- Q2 y8 R% gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 ~. B0 {" y% }3 W0 i: Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 }) _6 a9 |6 e- e- {2 M2 y8 Q: @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 u# q% c; r; z/ t' \
write('</div>')1 `$ R/ ~( i+ X
}+ F5 q2 B# d0 X, X5 O; A
else if (document.layers){/ {1 |7 r8 Y- [7 S( n2 k4 |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ ^: N) R! k$ H2 Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); Q3 h* Y5 g, ~$ y7 u6 g" q3 q
write('</ilayer>')  ]! U- G6 u3 E- o/ B; q7 J
}
1 _+ u0 M6 e9 T& E; a3 Gdocument.write('</td></table>')
& s; G' r, p) n% b" L2 Z}' @2 K3 ]0 [# }2 @, c4 w
}
: W$ m$ ?& m- H4 M; L- V</script>

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