|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度/ ~9 i3 i1 Y" {) t% y
var marqueewidth=300
+ i( e& N1 c6 z- \3 N//高度6 @* U u& \3 N1 |; x& E: }, d
var marqueeheight=254 l- M( s+ `. b, e& y/ ^! x: q
//速度(1-10)
; Y. ^4 N% f6 |$ j! Q6 W6 i2 ?var marqueespeed=3: n5 u' r& n$ O" b0 V; V& ~
//背景颜色+ t4 E: L o. v
var marqueebgcolor="#FFFFFF": Q' ]7 w+ I/ K3 d) v# f/ x
//是否能暂停 (0=no. 1=yes)?
8 _7 n* J8 e: x8 L$ `* D; mvar pauseit=1
. v! Y5 ^2 D( K6 u% L! @
! g1 Y0 Y0 P3 D+ E. s//修改显示内容
9 A1 I8 H" Y% }+ P+ L. D+ Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ w1 z% o2 U9 ~7 Y, q) e# O
# X" W9 v: M f: N2 Z. K, F# W( \* ^" ~
////下面不需改变////////////
- ~8 M' l: d* O% v9 A/ f6 a. O/ D8 \1 Z" C/ ~! N
var copyspeed=marqueespeed
; X' \1 m5 b0 [* s9 ^3 @" v8 Avar pausespeed=(pauseit==0)? copyspeed: 0
9 H- W4 S" b2 b+ J0 ]var iedom=document.all||document.getElementById' ~# Z; b8 H$ z+ E& \: [0 l$ F
if (iedom)) C6 A, [9 l1 f; i4 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 x+ x: ~$ Z3 O u% M4 s5 J. \
var actualwidth=''
$ X1 J- ~) ?/ Jvar cross_marquee, ns_marquee/ }, s% G- o, _' r- p) ~
! Z' s3 f1 g) Y2 w3 v/ Y
function populate(){2 X/ o! h; k4 e) k6 O% Q. W% u% {' }
if (iedom){" L% Q7 }- h9 D+ d( e/ _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 D* v% H( q5 }1 n6 v }cross_marquee.style.left=marqueewidth+8
- e. J( b' ^' B* Rcross_marquee.innerHTML=marqueecontent
# a! l2 R# p E* f! Y' vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 o$ g; q6 a8 Q4 \4 E; L}' @8 ?2 G$ F0 E8 `
else if (document.layers){
7 w' f* h9 }& _: A% N8 |ns_marquee=document.ns_marquee.document.ns_marquee2+ f: j# T% }8 a' o9 q
ns_marquee.left=marqueewidth+88 o6 Z; l% z* z$ ?2 Y
ns_marquee.document.write(marqueecontent)
( |9 Z, M- k# N" b2 gns_marquee.document.close()4 y" z) y0 }% i- R' H
actualwidth=ns_marquee.document.width
6 `/ H5 z( K; Q3 a}6 T) `* s: \0 g
lefttime=setInterval("scrollmarquee()",20)+ \* n2 g0 m: g3 X
}
3 N- q. j4 D" Z) O- t' fwindow.onload=populate( X" n0 n3 g! T% P0 Y$ _
/ j) d; [: K2 r1 l" _9 A! Z; t
function scrollmarquee(){
: m8 H0 M/ a$ tif (iedom){
( J; e+ j5 [0 W5 K& g" {2 U& ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# Y u( ?, w9 B/ Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed q6 x, l: @4 j+ f$ @
else4 k& ~1 b6 Z2 a5 h
cross_marquee.style.left=marqueewidth+8
! I6 y. |- P, }- T# L1 A2 D z7 h+ J; c+ I4 u8 p5 h
}9 C) v! F K5 F9 W! }" N
else if (document.layers){
7 q- B9 f W. V* sif (ns_marquee.left>(actualwidth*(-1)+8))
* N8 }' a" E, Kns_marquee.left-=copyspeed
9 F# ?% X- d) z( {8 i+ `- I: z+ ~& `else# i0 \% X( f4 g( Z0 @
ns_marquee.left=marqueewidth+8
& V7 r1 ?/ h6 i/ i}
/ U( @8 l4 K1 i2 H* `5 d+ T}
5 B/ A0 c5 M4 d% k3 y
H; F: K6 @8 u: f8 g% d4 oif (iedom||document.layers){) T9 H8 z4 B) _2 w# a# L' i
with (document){9 M( ?3 ?/ y2 ~' L. p, O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, F* P! @+ n) U, D. a, zif (iedom){. {2 A/ V5 v) F5 Y+ H9 S5 W7 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 O8 @: F! Y+ G& k( s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" p4 ~% V! Q0 ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" y/ w7 [/ I8 j3 ] u4 ~write('</div>')' ^9 }* V( z& j, R3 Q
}
( h+ d3 n, @& W8 t$ Melse if (document.layers){
: s. x4 A+ N( W: Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- h3 S( u" e2 A3 J+ Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& A' y0 @1 `- Q5 M. vwrite('</ilayer>')
1 S" h! j/ L# O9 s3 e$ V" u}- x1 Q. Q8 w) Y+ q+ a; c! ~
document.write('</td></table>')3 S5 P+ H0 J: E0 F
}, _0 T# k8 F5 e' i4 Z# k: q6 l$ u
}9 i$ Y2 {& i1 ?3 G9 P
</script> |
|