返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 r& H9 c+ ?  ^; {* q) ~$ H
var marqueewidth=300( i6 u* N4 f& o6 I' L' o4 t; N$ [! o
//高度8 B! H9 ~  ^. H+ J( M0 T
var marqueeheight=250 ^0 ~2 P# x. f3 N# q, G
//速度(1-10)
9 u/ g' }) S+ C" rvar marqueespeed=3
$ U& h$ C5 Q. y4 T//背景颜色: x3 B$ s) y: K3 d$ a
var marqueebgcolor="#FFFFFF"7 O$ @, i/ C! J" d6 Y; L+ K
//是否能暂停 (0=no. 1=yes)?
; S/ L9 b3 W. d0 Jvar pauseit=1
5 m: H: ?. [* v0 [# {# c" ]: I! r, ]( r6 A! \! G+ q
//修改显示内容; T. A$ C/ y( R' O. ~2 q* A0 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 U. I! a/ C$ c/ H4 J$ d
+ X; j- U/ x" Q

# q( i, H' K4 s$ S3 ^/ V! C////下面不需改变////////////! v6 a0 f8 u& o

% N7 `$ I8 z% `4 \var copyspeed=marqueespeed
1 o4 Z* h/ d& e- _/ ^* r. T& p; \; Gvar pausespeed=(pauseit==0)? copyspeed: 0
; c0 ?+ g1 P% b( t: [% j( q! f8 Uvar iedom=document.all||document.getElementById
* ?) _2 E1 X9 }$ u& R5 r* E3 mif (iedom)8 b  S3 ^# v: T# A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 A/ Q8 e+ d! B" u0 Z/ l' W
var actualwidth=''
. `8 i" P5 _: v+ `var cross_marquee, ns_marquee
9 ^0 u; L6 [3 X, a/ K
8 m3 o% k* k, {# U6 Z: t( ?' i8 [function populate(){
3 e& p6 U8 T1 c9 Q2 Xif (iedom){' k; i5 V5 K" j: D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ \5 z' g' @2 X  Q5 {; f; Ecross_marquee.style.left=marqueewidth+8
  _. t: Y& ?2 T, p+ c$ L- \cross_marquee.innerHTML=marqueecontent7 L$ J  Q% t; v9 m% j* C# R5 Q4 U, s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# j9 n1 c4 i! R" h) j' {0 X; K* ~/ \7 M8 Q}
6 T6 m/ o  r6 o  g* belse if (document.layers){
. M; d: {( J- n( f0 ans_marquee=document.ns_marquee.document.ns_marquee2/ T" V& G, i; `5 l( v" \: S0 `0 i
ns_marquee.left=marqueewidth+8
2 M" [/ x/ Z/ ?( |8 M3 Vns_marquee.document.write(marqueecontent)
' M& x: m; S; [& N* Dns_marquee.document.close()
1 ^; R2 b' {& Xactualwidth=ns_marquee.document.width
  E8 ?0 Z4 z3 \) k4 z2 @& M, d1 z}; {- {$ ]+ Q/ u2 f
lefttime=setInterval("scrollmarquee()",20)6 f8 ?9 x9 r& t3 r
}  t0 }  g( O: I) j, H
window.onload=populate5 I: S$ S' Z. z3 [  b, R

4 z# Y8 t3 ]0 Q% |6 e  c5 t0 _+ K  G1 wfunction scrollmarquee(){
9 x1 [/ M, J; I+ C4 iif (iedom){
3 R' V/ \9 M  k' }& Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 I" H6 z5 Q1 X6 S% R" W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' m* ?  T/ V  t/ Y8 a9 R% r, H/ E- N0 e
else
. O; q% ?9 p: [, m/ Y( Dcross_marquee.style.left=marqueewidth+84 f3 z7 Q/ i" |) e& l
$ X$ Y  `9 o1 x# t
}
' e- y& q1 l3 k  P8 @2 |4 gelse if (document.layers){6 _# Z4 g6 Q+ A. W: C; ^) |4 |
if (ns_marquee.left>(actualwidth*(-1)+8))  @4 H  D7 q0 Q: A4 S7 N9 G1 r
ns_marquee.left-=copyspeed6 E9 w- L9 Y1 u4 E
else: F2 I2 Y9 P' {. A% R
ns_marquee.left=marqueewidth+8) g3 j5 `  W- _5 i; t& R, F0 L
}
* V5 b: U; K( M* O. r9 u}9 u/ D+ D3 B! R. p6 c7 l5 S( g
" l# ^! `4 i4 s' B0 ^  z
if (iedom||document.layers){" `; ^+ E1 J2 K# _! o" j
with (document){+ _6 _1 c! X" ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): a  Z5 G2 }0 x$ v8 {, L
if (iedom){
; _: b. b' \, C  ], \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% w# W$ w) w7 e( z" ?$ n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 Y) ]+ \' I* q' y0 qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ v3 I2 W' h$ w6 v" i8 F
write('</div>')2 V# ~8 @, ^9 ^! _
}8 g+ e7 T' c' H3 o5 g, H
else if (document.layers){
& Q# z8 B" k- \+ G8 e8 ^4 j+ `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) Z/ _2 [+ W# q' b/ Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) k+ b9 R! h9 ~/ v7 ~1 d+ dwrite('</ilayer>')
# m  a: I0 n: n% x- x}
' s( q" p0 h+ z: o0 o. t- D& E6 d  udocument.write('</td></table>')( s$ _3 L$ L$ l
}
+ d! x: F- o: [0 F3 k5 l- O}4 _5 w0 Z2 [' h  {! k5 h1 w
</script>

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