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

|
网页之跑马灯文字特效
//修改宽度$ X2 b' l+ W" R8 n, A
var marqueewidth=3006 _* j" }# s8 Z( L. |
//高度
2 E# @' T$ t$ |8 a( @var marqueeheight=25
3 X: u0 d0 w3 o9 K& K//速度(1-10)
4 `5 o( d3 N8 c" ?* Kvar marqueespeed=3
) h4 r. X! u3 d! |/ @' @7 K//背景颜色+ i6 A: N' l3 i2 q2 L4 D
var marqueebgcolor="#FFFFFF"
, V1 z* `2 k" L$ i- f z/ c//是否能暂停 (0=no. 1=yes)?
7 b ?9 z& V& d/ dvar pauseit=1/ t0 E& `# D" M6 S+ y1 z- F5 D8 y: S L
- g. ^( U, x- g4 R
//修改显示内容
5 \5 y6 A$ y7 ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 ^* D- P9 l7 R& ?* X
! Q: I% G) @) G, I( U+ ]: q0 p
////下面不需改变////////////3 g4 g) N B! m R
0 D5 L( O8 o8 P) t) ovar copyspeed=marqueespeed
9 C0 q" j: k( N& P' Z+ x; D8 avar pausespeed=(pauseit==0)? copyspeed: 0
" J) U |2 S/ @( z( S. X, E& {/ [var iedom=document.all||document.getElementById" M5 o$ u' j8 w& I
if (iedom)
; V) M; `) ^! v, y) V% C% T: Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ |- ?) S- |) p8 F2 Y1 jvar actualwidth=''
$ E5 J! a& _1 ?4 ovar cross_marquee, ns_marquee
) D- Z' S! Y& f
! `7 ]% K' K Q" g% y4 P6 ofunction populate(){* D+ ~! Q. h6 ^2 A/ b6 B+ w
if (iedom){' P$ v( c' l6 t) X X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ H6 V- F( r4 N# Ucross_marquee.style.left=marqueewidth+8- T* l2 m8 m. d$ R: `" A& y, a5 ]
cross_marquee.innerHTML=marqueecontent5 @5 T* r" |/ n! M7 ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: A7 S. [1 ?9 V5 @9 N4 ^5 T
}& I1 ?" W) O( j2 n+ _
else if (document.layers){4 m' m8 a9 a0 e! S, u/ t( z
ns_marquee=document.ns_marquee.document.ns_marquee24 v# D& Q3 M& ] g
ns_marquee.left=marqueewidth+8% Q/ m) L( O7 P, c5 V7 k# M
ns_marquee.document.write(marqueecontent)' J, Y! S) W: @6 N h) Z6 x H
ns_marquee.document.close()
0 E! ^5 v; U0 N6 Z* T# [actualwidth=ns_marquee.document.width
5 L% A' \9 b+ M: E2 f6 R}
# U/ @4 r6 E8 i3 l- k# g3 jlefttime=setInterval("scrollmarquee()",20)
& ~! L7 u! O" ^}: j$ e+ O+ H! w* _8 C) W. l. |
window.onload=populate% k/ y/ y. z: n
3 l; E& D, Q7 q* m& O9 R3 V! cfunction scrollmarquee(){
M B9 W3 z) `7 T% Wif (iedom){& H8 m& E3 f0 Z1 ^8 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 m. }0 _3 n& \& q4 j7 O! n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) j- N. X; @% Z. n
else. Z% D, y1 D; s6 C" T6 z
cross_marquee.style.left=marqueewidth+8
! x) I3 a: Q: W
" _- w% M+ ^( `% F}$ o+ d+ M0 \* b5 T/ \5 @
else if (document.layers){
& S6 C4 z) q) y5 ~if (ns_marquee.left>(actualwidth*(-1)+8))
6 m# j# ^2 _/ h& {+ Z) }ns_marquee.left-=copyspeed
& q2 i0 j6 [8 c9 qelse
# Q3 T+ f$ [% a9 v4 \. {' n% Ins_marquee.left=marqueewidth+8# Z& O l, E; P
}4 P8 t' C6 A" j- [* p* N! E
}
" O! d1 Y! X1 f, J+ ]
* g# X( p9 C' E( b+ j0 A- \if (iedom||document.layers){7 R- S, S8 a4 ^ B0 T z
with (document){% I- o; I1 k8 _! F K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. U& F) {6 m7 T! p0 [if (iedom){& q7 Y- e: E- j8 u! A8 U X0 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! Q6 A, Z) T, xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 o! [% ^7 Q% T/ q. Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& v# B0 r1 h5 n$ o& Mwrite('</div>')' ]- L+ v( H" V& j
}
- M, s" x2 `+ u g9 I2 v9 lelse if (document.layers){
0 j* J# c: f- x8 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 c/ M# u1 y. l. A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ h1 X* l2 b' G) @! E8 \" wwrite('</ilayer>') G0 B8 Z5 K+ y) m
}1 h! |7 s. h& A4 @! ?
document.write('</td></table>')1 A2 R0 {/ T4 Z( M$ `
}
o* G3 Q6 M9 h( b( E% C( F4 ^}
6 m2 v0 T \4 R) n* R</script> |
|