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

|
网页之跑马灯文字特效
//修改宽度
: J6 k- w. f" c+ `var marqueewidth=300% t/ S& j4 H9 S3 B( e- V: O9 G
//高度
! t# F/ T1 R! i, ~& K' zvar marqueeheight=257 `9 x2 e! w" I4 ^; ~/ ^
//速度(1-10)3 y: B* @9 }8 t' o3 R# G5 `* W
var marqueespeed=36 `! O+ I* D: c) r
//背景颜色
1 v; b" k; O9 O* Uvar marqueebgcolor="#FFFFFF"9 y" B1 N* \# k9 Z9 z
//是否能暂停 (0=no. 1=yes)?
" j% Z4 R% |/ T, p* ~- Mvar pauseit=15 n! H. N% \5 G7 f: Q5 m
; L! J0 G; V9 T1 O' [% [ k
//修改显示内容2 O; W/ A/ `/ v- s Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ j1 F8 R' X' V8 A3 V2 q; S; R, m0 I7 _$ c- W; i/ j. G
- P3 S/ ^: L0 Z+ W: ^4 L- s////下面不需改变////////////4 q$ [ c: k j
1 G6 T) l5 n; `2 t* X
var copyspeed=marqueespeed
3 ?5 o |+ k5 L* W8 Z {2 J6 g/ \& U3 Dvar pausespeed=(pauseit==0)? copyspeed: 0& p! y9 A4 L [; f6 U: [" p
var iedom=document.all||document.getElementById
5 H. |4 z7 K6 z8 X9 Gif (iedom)
0 l2 |2 S$ X8 \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, C1 p/ O' Q9 @7 ]! V2 t$ Ovar actualwidth=''
: a4 S, [$ {8 Pvar cross_marquee, ns_marquee0 O$ {/ m7 }3 F5 q& M+ A
) m; `. Z) [2 }function populate(){9 R, t) N8 G0 E" w2 c) b
if (iedom){" O# o ^9 z& n! K! b; r$ A# _3 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( v* s' ~0 R4 }
cross_marquee.style.left=marqueewidth+8
+ y: L9 v7 y/ U7 I. ]8 [4 H) w% qcross_marquee.innerHTML=marqueecontent Z. P6 S7 J( K f3 |# H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 J: J& Y# |: l% X$ Z- U8 }/ e$ S2 c}
% R- }3 `2 @# j, }; aelse if (document.layers){5 c6 F2 J0 ?6 f$ k: N1 w0 l( ^" q
ns_marquee=document.ns_marquee.document.ns_marquee2
. p( N: W" I* y2 l% _ns_marquee.left=marqueewidth+8
5 q4 @! ]1 ^( T. ins_marquee.document.write(marqueecontent)9 j: t9 H% ~9 G; i; D$ s. j
ns_marquee.document.close()
1 i8 [) |! ^3 r5 ?actualwidth=ns_marquee.document.width
6 S& R1 \2 B. T; Q( s) q- e}
9 h& b- R6 [# M/ ?4 C! w$ Alefttime=setInterval("scrollmarquee()",20)9 K" {8 T. _" Y/ N
}% w- \: a; B& ^/ k
window.onload=populate
4 t, H$ ?% F% N, ~3 R# g7 ]2 `' ^1 [ U8 U
function scrollmarquee(){9 A b E/ u# h. l+ ]* R; L; i
if (iedom){9 L1 g( h4 H0 t$ E5 h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" i, p8 r! M- f, b' Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. d* X2 U7 j6 L' ?
else1 z4 T; z' L5 P; A
cross_marquee.style.left=marqueewidth+8
+ B0 P# e4 D" I: q2 p
s3 g' Z& |8 o}
# I& o' Y9 }3 h% {7 Q" O8 j4 F {else if (document.layers){( d7 I, h! R' a: \. U; i' ]
if (ns_marquee.left>(actualwidth*(-1)+8)): i6 ]% _3 Z+ S
ns_marquee.left-=copyspeed
`% k/ Q8 E# _6 a/ d& |+ ?0 aelse8 E. p* ?( @$ @
ns_marquee.left=marqueewidth+8
* Z. k. |) g5 B; Q}
! u& {8 y) B+ P& \9 C}
" |7 f" a* X! L+ l, Q/ X
; z& b8 s+ ^' [8 aif (iedom||document.layers){
* ]; V( y7 b% n1 h" \/ R7 owith (document){
& Q2 H' p1 g9 |6 a; q0 p$ x7 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 R9 ~3 F4 q- J' Hif (iedom){( N5 {( G2 Y; [2 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! a: l8 Z6 n& }1 i( F& xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* D& r8 k/ C, K: C! mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, s! s. r2 m: {/ u; v. R2 m% H/ @write('</div>')0 ?$ }2 p" Z0 @* B4 V
}
4 H1 ?- R$ j8 Kelse if (document.layers){
, E5 r% e7 m! g) u% bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 L) l7 \; ^. @, n) |; I4 Q% ?/ Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 o" i% z5 k' g7 B" ]& [( Z
write('</ilayer>')
4 `) k5 Z8 `/ G) j9 h8 I* O0 n}, ]. p k. \: e$ T' @
document.write('</td></table>')4 i( T9 d, U3 x% e6 S( f/ {& [
}5 B2 c3 x: p# l
}. X# c3 F7 i9 t) l
</script> |
|