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

|
网页之跑马灯文字特效
//修改宽度. Y [# _4 s& s4 n
var marqueewidth=3009 l$ p3 \, ~8 y4 w; t
//高度* j& |4 F+ v7 @' D* L U
var marqueeheight=25
4 i1 x# Y& b1 [//速度(1-10): h: E- C4 Z% ~( P7 N
var marqueespeed=3! w5 e# {4 P4 f/ v, Y3 G
//背景颜色
) E4 w/ H6 G% kvar marqueebgcolor="#FFFFFF"( I1 S* v B: ~' A0 L) a
//是否能暂停 (0=no. 1=yes)?
* ~/ l, ]# K1 J: bvar pauseit=1
$ P- O& A" Y0 w7 f
0 g- P- n. _1 V' t) U+ ^//修改显示内容
% [; ~- h8 n- }+ V; hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ o: p* D% n! \, b+ k$ L1 j8 R
4 H) g- }% a" D# S, |- e2 @
7 h# i! [# y/ e1 k9 ~* j1 T////下面不需改变///////////// P" n8 [& E. j+ ^/ J, w4 {1 W$ u8 k
* s2 l) Z. C+ @; ~) P/ J8 _* j
var copyspeed=marqueespeed' L6 G1 }- m: u
var pausespeed=(pauseit==0)? copyspeed: 0
1 w K6 |+ K% s% C7 W6 avar iedom=document.all||document.getElementById4 l w4 T# i/ O. z3 ]) V
if (iedom)' _# v% Y, G6 K) K c" Q) u, @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: x' a3 a" d: H) `% u8 Cvar actualwidth=''
Y7 w9 l, K# y! kvar cross_marquee, ns_marquee
, o9 E. g2 O3 t+ f4 {; O1 D0 w3 r& }/ O$ P& Q8 ?& g
function populate(){
7 m8 [4 K! `8 ]) Q0 J5 y6 Mif (iedom){3 S* W& z) V! f5 p2 y' f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ N ~" M ]% d: n
cross_marquee.style.left=marqueewidth+8
' E/ s3 o% F2 C& `$ ^cross_marquee.innerHTML=marqueecontent
$ x% Q% r4 e( j" z4 E( J+ zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 Y+ V& L6 a( g4 }9 w( x/ X}
- C `) Z8 @! _' M$ A; o7 zelse if (document.layers){7 N. T4 j0 O7 n
ns_marquee=document.ns_marquee.document.ns_marquee2
+ ]+ k6 B$ k, `0 \ Fns_marquee.left=marqueewidth+8
& Z' L# F0 q2 y+ |ns_marquee.document.write(marqueecontent)
0 Z" g# Y& Q3 S/ G1 m W& x- @ns_marquee.document.close()
, i0 X# K2 P: ^9 {4 ]& m6 P2 _actualwidth=ns_marquee.document.width2 l G) Q9 q1 f' U% t9 |* W l8 J
}
' D0 S' o: q6 s# dlefttime=setInterval("scrollmarquee()",20)/ d a9 f) g" z+ U2 E
}
: z- o3 x/ v. B% v7 Kwindow.onload=populate
/ x7 i( Y- J7 L: L# n: n* D9 b' n; u5 Z( D5 S3 @& |% C9 O
function scrollmarquee(){
4 |* u) V$ g1 z+ ~; ]if (iedom){2 T( p! q9 k& I% n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( |+ _9 }1 C+ ]. ?* g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, @. d- K1 W: C* N2 T5 z
else
5 A7 V, M5 F1 r9 v: K: D5 tcross_marquee.style.left=marqueewidth+8
+ {# i( F4 O [7 F9 [
, B; _' j% Y; W1 \3 l0 ^% h, V}7 e0 L J1 S6 q8 s4 v6 t) [) a1 ~
else if (document.layers){
?4 j2 K! @2 P. B$ g" J$ e/ bif (ns_marquee.left>(actualwidth*(-1)+8))
& |7 U- o- I- c! C; Cns_marquee.left-=copyspeed- N" |5 {( w! q ^; h& j* Q4 T4 L
else
9 E* W6 c7 R* l2 D% i0 a+ } F& @ns_marquee.left=marqueewidth+8 R+ T( i% d3 [' `
}
; A' @5 G2 P+ c' r- t}1 a* c+ \5 Y: u) \ Z. x1 w. a0 B
) O* z% d z" C1 X/ l7 Uif (iedom||document.layers){
1 O. C- k) g; f# Cwith (document){
# F' D/ h- P- T8 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! ^ ] c1 h) [, |if (iedom){! t! k( j, M; T5 ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 L, O# w$ h% D2 B! Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( l) D: n8 F9 O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- z" T& w) F4 _ \- P8 Z; S3 d4 Qwrite('</div>')+ G5 ]1 C6 s/ `/ D! ?
}
: v5 ]( U8 J% q uelse if (document.layers){- w7 c8 _4 Y# B2 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 K* h6 b; R% B- \% k( [7 f& x! z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): {- k4 t( g8 b- M4 V& U p
write('</ilayer>')& u' r( E- z O- {0 i( o( p
}
- e3 p3 R1 G w0 g" h* ^- k! Ydocument.write('</td></table>')
' k% ~% X8 l/ o, u8 |5 d& G}, |# t& G" }+ `0 Y/ F" j: {- L
}
[. z( l$ x. T) n</script> |
|