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

|
网页之跑马灯文字特效
//修改宽度3 _5 U$ @: a9 f, h8 ^
var marqueewidth=300
, j8 \8 T' Z( O3 ~//高度
& Y h! k3 J3 f3 i# ]var marqueeheight=25
; v, }; {9 D8 ~" ]) {3 K& y3 H//速度(1-10)
& C0 U. u, v$ c/ b6 U# ?) L2 J: H( Mvar marqueespeed=3: r' n' [+ m: J4 G% k8 L' P
//背景颜色
) c! s! V3 Z8 n9 H. w% S4 ^var marqueebgcolor="#FFFFFF"
2 X( C( _: m7 g$ }. p, d//是否能暂停 (0=no. 1=yes)?
1 P; S$ B- r: o) h) @8 R0 @var pauseit=1# }4 @+ i+ W4 {8 O. c: P5 D
3 m/ C* U: X( n* V5 W. e//修改显示内容 E: l: k {0 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: o3 {. Q8 c: Q" m. T
7 R1 W" ^0 M6 }( [9 x) X
! e) C4 O# L: {////下面不需改变////////////2 v) H. s. i0 ]( _# @
1 r* r7 n$ `" ]* K: Y$ \4 c* t( vvar copyspeed=marqueespeed6 e2 |1 E; N' \ x
var pausespeed=(pauseit==0)? copyspeed: 0
/ q' h& W; V9 r! t$ \ B- T* zvar iedom=document.all||document.getElementById0 m B/ D! K' [# x6 h. t
if (iedom)& ?* o* r' e& g' p9 b$ n! G+ ?/ b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ o$ W- H# h H' c# X/ \var actualwidth=''
2 m$ ]/ \7 d) k: Z9 Tvar cross_marquee, ns_marquee
* h4 R7 A0 X7 N" |9 V% D& Y- Z! W
5 Z9 }% Y8 O) N1 _' \function populate(){( o3 v7 D8 {+ d+ i7 S0 i% p9 l" `
if (iedom){
/ `# _; |0 R* m' L# [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ f% _7 ]4 e, y0 r/ _
cross_marquee.style.left=marqueewidth+8
' a9 H6 n' B8 W6 H# p. L+ Scross_marquee.innerHTML=marqueecontent( ~: u0 ^. z7 G" ]: q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, M- b; p: S. g9 K W
}) w$ N' Z) ~ ~0 W9 e
else if (document.layers){
6 M: i, ~1 O0 `& Xns_marquee=document.ns_marquee.document.ns_marquee2% O9 g8 o- B! b7 R6 {# |
ns_marquee.left=marqueewidth+8
' ^2 q, x( K( v& }3 e# g- D4 hns_marquee.document.write(marqueecontent)7 ?2 Z8 `( |9 c6 Y4 r0 E- Y
ns_marquee.document.close()
9 k# g" S! t! zactualwidth=ns_marquee.document.width4 W* B; s/ G8 n5 I U/ I
}: Q5 M( R3 a- J3 j/ _
lefttime=setInterval("scrollmarquee()",20)# f4 M+ Q* S8 j+ {6 o9 U' o) o5 a
}3 x4 j! J& Z; M6 }: u
window.onload=populate
0 ?. i& L, I9 k
8 |! n: F5 J- {function scrollmarquee(){6 A5 t( y& o* u# ]3 k
if (iedom){
4 P" k7 a. B1 a! x2 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. _* @7 N8 ~( ^0 T0 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% h( q) Y2 ^! Z6 e& u
else
& i6 a( T1 G% s$ M5 x7 Bcross_marquee.style.left=marqueewidth+87 P# u2 m5 f6 t Y
/ d6 H7 R4 V1 d+ I$ l8 z}
# s1 N+ d2 x' N4 X' y5 V& D- f- yelse if (document.layers){
# f1 W8 \: x4 Yif (ns_marquee.left>(actualwidth*(-1)+8))
j3 w e8 S$ Rns_marquee.left-=copyspeed! O9 u( D. U6 V8 R
else
7 ?, O, L; S3 @6 K* @, |+ O& Jns_marquee.left=marqueewidth+8
& ~- {4 \8 @0 z7 B5 A8 {, h8 _}
' T4 D% ~: z& n# j}
4 y% F2 e8 `6 S: P6 {9 H" n. C& c0 @5 O# { l; X& e- b
if (iedom||document.layers){: z5 n0 u! h+ b' {
with (document){* \ I2 s8 T( Z" x* K) F! l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). l* q- V* v8 h4 d0 D& B
if (iedom){
4 Z0 ]- T% v' @. S; w ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 H5 @. o3 f6 {2 b4 k) Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); h% w" {5 M. W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 c' q; D1 t/ c( vwrite('</div>')4 F5 o( `2 g6 S3 S1 W }! a/ D5 S
}
! c: W2 k& a3 F6 v+ h7 Pelse if (document.layers){
9 q" Q" k+ S' h9 S, Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 D' @& `) w; G0 m- f9 q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
~# S* b; E o5 J- Y$ k( z% Bwrite('</ilayer>'), I2 C+ T0 i! }5 U
}
' w( |( t6 e9 X+ d+ V, S/ O& M1 s: Ydocument.write('</td></table>')1 U2 O" c2 [# l2 ~% L
}" x- b; T6 Q: i4 l9 s$ g; N
}3 w8 }1 x/ V" y# m, {* E; S
</script> |
|