返回列表 发帖

网页之跑马灯文字特效

//修改宽度" Z! T$ [- p" }* t. U' t- s
var marqueewidth=300
+ s; M$ V+ H0 ~//高度
; r0 c' b3 d8 S6 H& _9 f7 Jvar marqueeheight=25
3 j* \+ b3 {# v8 T/ ?//速度(1-10)9 ], S5 T( f6 g
var marqueespeed=3+ y$ x+ _) ?3 c
//背景颜色
; P6 f* d( s1 p! Y3 {var marqueebgcolor="#FFFFFF") @" J; ?2 X' z
//是否能暂停 (0=no. 1=yes)?8 ]3 E  T2 j! `7 F7 b
var pauseit=1: j' D6 t* t" u. j

& @" f4 K+ d; \6 y5 |& i//修改显示内容3 |3 h* j& w% X8 B8 ]$ @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' P- e! w8 \  h1 \

" l2 s6 u6 w. Z) h  Q/ D
1 j* @! n% T& _////下面不需改变////////////; a0 k% _5 x' ^& y
. v3 b4 e- w6 M! `: W7 d
var copyspeed=marqueespeed4 f2 M; \% z3 e: O
var pausespeed=(pauseit==0)? copyspeed: 0% `. |* f3 h  ?2 W3 {+ @
var iedom=document.all||document.getElementById& H. Y. `- p7 H' _
if (iedom)+ ]7 g2 j/ n& C6 c5 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 T7 p0 |. Y! a# u  v, n/ z( o( W  A
var actualwidth=''6 D0 ~9 l. N1 i2 t) R
var cross_marquee, ns_marquee
, O! T& b- f( V. Z3 a: q7 r5 q, j* d5 m' C* X
function populate(){
3 B* ]8 h  P* d1 y, f# c* Qif (iedom){8 w9 j1 J+ c' H8 C( i. `; J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 [2 h, v; O* g- `/ ccross_marquee.style.left=marqueewidth+8, a: h$ C2 M8 W4 |# k. J
cross_marquee.innerHTML=marqueecontent* X6 h7 \& R  c' g5 Q. x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 H' a  k  [! G- N7 ~}
% n9 F% O" C: H: H3 Selse if (document.layers){' b6 W5 x' u4 E& |' z4 M; p
ns_marquee=document.ns_marquee.document.ns_marquee2
6 K2 U) L( f9 E7 P: Gns_marquee.left=marqueewidth+8
+ y* O% B6 v4 I) k9 W' h. Zns_marquee.document.write(marqueecontent)
7 o4 t2 z' D' O8 o) B5 j+ C" U5 j$ r  fns_marquee.document.close()  H" s, D' S. M% y7 r
actualwidth=ns_marquee.document.width
# p# k! l  w( q( K9 X, X+ F& x}
- K8 G& g1 b$ H1 Ylefttime=setInterval("scrollmarquee()",20)
  f( R( W& z% c8 _+ K# `}
2 e# I" ^5 Y( x: @$ rwindow.onload=populate
8 l% W( E) B$ p$ d3 o; b% _( n7 H6 q6 K* l
function scrollmarquee(){# B, X" G2 N: _+ q
if (iedom){$ G$ l2 I' l( t# B# b3 Y. W  c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ j3 j/ O6 n, I( F2 mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ |3 m* ?- `& \& u* i1 {6 p: D! B
else
" f# T, R/ ?  ~5 P0 across_marquee.style.left=marqueewidth+8
+ I) J- f$ o" b" F3 {9 m
. x% u! ]7 Z: q' n}- E6 p; ^4 @8 V- u
else if (document.layers){
( Y  ]  X( D2 G8 cif (ns_marquee.left>(actualwidth*(-1)+8))) E: \+ F1 Y9 b& t% R
ns_marquee.left-=copyspeed
4 `) B  r8 ~& K7 A- F+ i! @7 Nelse- e: x! X. R* t  k: Q
ns_marquee.left=marqueewidth+8
$ Q; @( S$ _" _! g" W6 q5 @, u}
& A0 `. B: g6 Q, U}
# B* M8 g( ]. ]1 j* E: h3 g) l4 ?1 x5 z& Y& K
if (iedom||document.layers){7 X& e8 P# j& y0 M4 {6 F
with (document){3 N6 h% n' K  K! J7 N# _- U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: D9 D6 A: K. z" R/ v: v: @( dif (iedom){
* w( c; [7 W( o+ V1 r6 t+ V" jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 s5 E# f" r9 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. m: k) S( [9 l; A0 S* I' O& Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* o' w, }. F! t8 f+ M' f
write('</div>')
- }! o& d; ]6 ?# g5 m}
" ~& y9 X3 Y0 X1 y  H- n/ f. aelse if (document.layers){
. Y& {) K/ H1 f6 T7 i5 hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. p. o' j5 N# w% Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 i" r% u3 x7 r, d  p! N+ j% n
write('</ilayer>')
! ^( ]# `+ J3 ]' J4 v" g' N}
5 \6 h' \* ~5 T6 I, Wdocument.write('</td></table>')
- \4 p$ X* V. P/ w$ X" f- Y}
# b! I% y# [: D1 D5 V}/ m* A& B+ _; w" R
</script>

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