返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 t. |( X; t: g) Z: kvar marqueewidth=3004 ^3 x- d7 ?) T% p& D- k4 N
//高度
' E: X- z2 m9 v8 K7 g$ v6 I3 e2 E; zvar marqueeheight=25
; e8 v2 a1 \* `- g) o* }//速度(1-10)
0 @8 j# M8 N# I4 m0 g3 z6 O. Uvar marqueespeed=3
  f, Q; T. l5 ]( B! J' t//背景颜色
' R. Z! g6 Q3 F- Hvar marqueebgcolor="#FFFFFF"
& L0 Y  V5 q) L0 {7 ?; j//是否能暂停 (0=no. 1=yes)?. w) E5 V9 D% X2 A" V# u
var pauseit=1
3 d( G  u4 h" T
) u8 ~2 J: v9 {  m7 s  N, X, V5 R//修改显示内容
1 L* h$ I( C, N" [. ]/ uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  z! `% G# l7 y  R  e

- V" R2 `2 q' n' a, q0 O. e1 b
: T& O( Y5 f3 S2 r5 f% f: k////下面不需改变////////////5 z& |$ x/ ?2 k2 A, L. v6 }

/ K% n' I+ x# \  Q2 }0 Avar copyspeed=marqueespeed
9 a' U2 q4 d# t0 T5 G5 R" Evar pausespeed=(pauseit==0)? copyspeed: 0# _% d% I( S9 c' O* q
var iedom=document.all||document.getElementById
+ F; [  y( ~2 i& Vif (iedom)
( H& u$ ^8 D! ~$ `+ vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ U. Y/ x; i- q2 v3 gvar actualwidth=''
# s0 m. x" {* y. F, D0 W5 qvar cross_marquee, ns_marquee
3 s: Q: J2 H- X, o
) t/ z! m/ Z. Z4 afunction populate(){" [, H" }/ ~' D5 W+ ?3 s
if (iedom){+ W& J% o( c4 ~/ Z' k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 W) n; v7 L0 @6 E! D
cross_marquee.style.left=marqueewidth+8
; ^' [7 {) V* N$ U& X. {cross_marquee.innerHTML=marqueecontent
" B# G5 r: ~$ I6 L/ G- Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# r% o' a% q3 N/ M7 b1 g}
2 d( I+ {5 t3 O( q( z1 v% p6 kelse if (document.layers){! i* I7 j$ G6 U- L9 D0 r/ a" V$ ]
ns_marquee=document.ns_marquee.document.ns_marquee2
/ P0 N5 U! ?( D3 e9 q1 |9 uns_marquee.left=marqueewidth+8
  e( B, P9 {6 Kns_marquee.document.write(marqueecontent)0 M9 z& ~. O( [5 F
ns_marquee.document.close()
5 q/ S+ u! G/ Mactualwidth=ns_marquee.document.width& I3 ~3 z) f8 R  Q* t+ k
}
/ b9 {8 ~  u& t9 h3 Zlefttime=setInterval("scrollmarquee()",20)
. |7 C7 t/ O1 J}
# T6 F. N9 ~+ @* ^* n$ ~3 K1 swindow.onload=populate
/ b8 Z% j- ?* m
% {4 ?& M$ Z' T" E. ?( m1 kfunction scrollmarquee(){
+ h) U$ s7 b% d# bif (iedom){3 ]2 _( G$ y" f& H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ P- u3 `) O' ~) m; {6 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, g8 e+ b1 M0 C- k( melse5 Q& \" M5 z( J$ o/ P
cross_marquee.style.left=marqueewidth+87 c8 r5 F5 w* i9 R; i6 x

3 l" U0 U9 @! C  X) X, L5 X}
2 u+ ^7 j. i, n5 ]else if (document.layers){
) c/ Q% C& K7 s, W6 M: Cif (ns_marquee.left>(actualwidth*(-1)+8))3 i! t! S6 M- a* q
ns_marquee.left-=copyspeed
7 u0 o6 x# x/ E& qelse( h6 T  N6 i# m* T
ns_marquee.left=marqueewidth+8$ u( g6 h9 S: o0 w
}
! P. g) x% z# }- S  z( f}$ I% @6 q' d3 G/ O

- E! G1 N) i$ W% T$ N2 X% [* k5 r( ]if (iedom||document.layers){1 @9 O( |+ \6 f
with (document){
5 i- d/ n8 d6 _& [4 B0 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 I( }5 K+ K3 \$ H/ M' U0 f
if (iedom){7 e$ |$ X0 u( L4 R; }# r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* n1 p3 w2 c" X" k$ w. I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) p+ D, {9 T  H6 B# z6 k. Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ K6 C! R2 ~; O7 n( h
write('</div>')- o- ~; }# V! k- O5 T7 s
}' N) z1 ^: m# }7 e0 a# l* Y! r8 [" D
else if (document.layers){
  Y3 |8 u9 F, f* t5 zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* h, v* }; w7 K3 \4 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ [5 E; y2 J% I7 a) i
write('</ilayer>')$ H4 j- U0 h  D& ~) z# B6 B4 f
}
# G- L! k0 F2 j' A, |document.write('</td></table>')8 N/ \9 w2 {$ s: h
}
/ g" Q! {) X" H" Z/ s- q5 P}. w! U, E" j( Z! b6 p7 N
</script>

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