返回列表 发帖

网页之跑马灯文字特效

//修改宽度" J; d& \$ {( ]7 a( T' E; p
var marqueewidth=3004 x1 h! G1 v) ]4 S8 T3 e
//高度
0 j! i. S; c1 Y3 ivar marqueeheight=25( ?. w- B9 y. s$ v6 X5 T% ~: P
//速度(1-10)
8 r8 ]+ N/ M% f9 }7 @3 nvar marqueespeed=3
. c2 X* d# X% l: q+ m//背景颜色
3 b+ T) H; W; I. t" Y7 e2 Wvar marqueebgcolor="#FFFFFF"# g, Y( a4 [) |7 P6 ]" s% m
//是否能暂停 (0=no. 1=yes)?
/ Y. b$ G! u  i, evar pauseit=1
$ I, ~( p0 a1 i+ F  B
" }9 X- H# {4 K" A//修改显示内容8 e5 D( c# T8 J+ ~* T1 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! u4 H0 t1 H, \8 F
. q9 [9 C! D4 b5 x4 F" `

+ @* v# a' B( J////下面不需改变////////////
. d! \7 L2 z) s# ~4 H  N& O9 r3 u$ m* ?8 Y/ @
var copyspeed=marqueespeed
5 O3 h7 Y  l* U7 h6 ^! Avar pausespeed=(pauseit==0)? copyspeed: 0
& v* B+ {9 D- D3 P" x; @var iedom=document.all||document.getElementById
0 s$ a/ H+ H( d8 U. pif (iedom)
) z. b- p! k; i. o1 c1 Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" m) m9 u/ i& x: p
var actualwidth=''
* D7 c8 p4 k, U0 u+ y$ Y  _var cross_marquee, ns_marquee
7 c$ c% \4 \* v' U4 C7 O% s. o7 E
- z* I/ c" `0 Q$ R( f9 S8 qfunction populate(){# f& q5 k- t+ K$ J8 Z; P9 v# @
if (iedom){3 {# K! V9 s  b" Y; g7 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' {  Y/ f5 D* f# D$ s* K" w
cross_marquee.style.left=marqueewidth+8
% {7 S- \3 X3 F9 qcross_marquee.innerHTML=marqueecontent$ @- D9 A1 j( e1 |" g1 y7 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  d' D) @/ ]! N3 `  x; }% [}) X; Q1 ^* @4 I
else if (document.layers){
- J2 z3 P2 `2 Ins_marquee=document.ns_marquee.document.ns_marquee2% `6 E3 ~  P; W5 P7 F2 a3 I: T% b
ns_marquee.left=marqueewidth+80 E3 j1 [4 c$ i7 R: d! ^5 _8 D
ns_marquee.document.write(marqueecontent)8 U; I, M$ l6 J- G& v( j; v  A
ns_marquee.document.close()
* c' I. }4 _" u! k. [  Ractualwidth=ns_marquee.document.width5 z( B# _" M) q- X' A$ ~
}1 ^: ^: j/ ~5 x3 V' N$ t, t# B9 J
lefttime=setInterval("scrollmarquee()",20)" {* Y' F6 @2 ]" e, }
}
6 t" O# s  D' q7 jwindow.onload=populate
1 g' P: U1 C8 U$ H$ D0 Q; w! I. I( V$ O, [, q% U
function scrollmarquee(){
6 @$ @, m1 W* kif (iedom){
3 p( r& l. ~  h* o+ r7 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 X' D& ^' k4 \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 o3 T' t) I* G/ e, K4 K
else4 T2 o7 j5 `" V. z
cross_marquee.style.left=marqueewidth+8' c) t1 O5 u& f* e* q( D/ U/ D

2 Q; [# m1 J; ^: M8 J" H- s: d9 O}
- g* [4 y  j  ~' Zelse if (document.layers){1 ]4 `/ r4 v, E! I
if (ns_marquee.left>(actualwidth*(-1)+8))
6 D+ c9 Z& x& M3 pns_marquee.left-=copyspeed4 P* R3 D# ]/ _, {* o& v
else3 n8 C$ B+ p4 }* S+ `' @- x; Z
ns_marquee.left=marqueewidth+82 T8 s# P. x+ T! I8 a; T; ]
}& Y4 W6 i2 d/ o
}
4 K7 z, W: Y; m4 O2 ]$ v0 L" ^8 k
+ w+ ]3 S2 q; ^: i: Pif (iedom||document.layers){) f6 J. N% a4 V6 r/ h0 f
with (document){  |- T2 A4 o% K. x+ @$ ^3 \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 T3 |3 @( D5 d+ u. e( ^5 V* g! eif (iedom){
9 G( G6 v) A9 L; [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 u+ K- m5 n1 ^6 y' P3 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# A& |. O7 O) Z/ Y3 t- @- Y  k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 s" `6 V9 k3 Z' [0 m" }3 C
write('</div>')5 G$ f$ I% b; \& D+ n& p
}
* w7 f/ r2 n/ ]! U) n/ H( \9 V! kelse if (document.layers){$ a& |; M7 a6 f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& q+ p; G1 d, \9 E0 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 Y3 y4 R2 x% a3 q% owrite('</ilayer>')
/ @/ ?; l% q# k" Y* W1 @$ K}
9 T) r" ?6 w# Pdocument.write('</td></table>')
7 F" _5 v& ^2 Y2 D( t* t& G: i" |& d}
& Y: J" U* v2 x0 q}
$ m9 V( a3 G2 o5 j1 E/ {8 o9 Q8 g</script>

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