Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
. K- v1 X, C& \* avar marqueewidth=300
# r) @( L8 X: c- ^" \( ~3 K3 m//高度2 ]8 ?7 g; O  j# `
var marqueeheight=252 W) b9 B: z, ^" V( |
//速度(1-10)' E9 v+ u; b+ K2 b) ]
var marqueespeed=3
/ Z9 J8 n$ p2 Q//背景颜色8 `6 M9 y! A1 }
var marqueebgcolor="#FFFFFF"
2 t5 _1 M1 u  s/ ^: x//是否能暂停 (0=no. 1=yes)?
$ ?) _) i4 }3 N0 yvar pauseit=1" k+ X$ W1 t% H( f" A! L6 \) C

" P0 a, D& l/ d# u$ v4 [( t! ]//修改显示内容2 o, \% ~+ a. a7 a& a$ {( Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ H. U9 U+ N7 x$ g) Z) T; G' {- B8 D  Y- J

$ P7 ^) Y, V; a# z! w$ C. G: S////下面不需改变////////////
' l; S* W8 I  d) }- Q- B" \; T( m! N6 n
var copyspeed=marqueespeed
0 N+ W' W' h7 ^7 b$ zvar pausespeed=(pauseit==0)? copyspeed: 0! Y/ B/ g: c% \: C( N" s9 K6 [2 _
var iedom=document.all||document.getElementById  p* L. Y; }! E0 z* E/ p, x, |
if (iedom)
% s! P0 G6 {% P& I2 F; W4 }' H. U, Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ |% B7 i# y( l3 e. `% g& r
var actualwidth=''2 d# g2 x; g- S+ ~& ^. u/ u
var cross_marquee, ns_marquee" q, \# l6 B+ z
, a) `; s6 A5 ]% R1 e2 }
function populate(){% }+ a. W) H$ D9 ?
if (iedom){
, w4 P, W/ ~! Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; p* B+ I( W( x) K3 c3 N4 q& N
cross_marquee.style.left=marqueewidth+8  a- s5 \6 `2 u" i$ F/ ]( e9 D6 J* d, ~
cross_marquee.innerHTML=marqueecontent- W, s; V$ R( F, Z6 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 g  J% g" f! V5 w}
' ^* S! y9 u) y5 R5 qelse if (document.layers){; P# O& x2 J9 x' u- d) H
ns_marquee=document.ns_marquee.document.ns_marquee2: D8 `- _6 j- R8 V" M
ns_marquee.left=marqueewidth+8
) c% u; o* x! M9 }3 s5 ?, rns_marquee.document.write(marqueecontent)
/ o' p  G- x6 M9 z; i0 K1 |& U& k9 Ons_marquee.document.close()
# [! l8 W. X+ |1 i' b3 bactualwidth=ns_marquee.document.width
: R+ w; E% ^) \. j}- A0 \+ Y8 ?: r& f, h
lefttime=setInterval("scrollmarquee()",20)" d4 s( w. r2 E
}
- H$ q0 j: u1 t: x2 S) @- e. _window.onload=populate6 M( x. t, T+ V. M+ L

: o: h+ \8 h' K2 s& |) Wfunction scrollmarquee(){7 \! ]5 X9 O; d' @4 T  r6 @
if (iedom){
/ L, X3 z1 q! fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 e$ A5 J" I: I" g% M, x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" _  o' ]/ t7 j1 [4 ?else4 q2 e9 \0 l. U. w$ w
cross_marquee.style.left=marqueewidth+81 l# T3 {& C& Z6 U- n9 i

7 z' J: c$ C6 |) [; U% ?}3 ]  p% f! _" C: D8 b' w# }9 ?4 k
else if (document.layers){
3 T+ Z9 l# p; Oif (ns_marquee.left>(actualwidth*(-1)+8))
5 G5 R. `3 X! J5 f$ J' xns_marquee.left-=copyspeed
; M" M: |6 P4 o0 \, u$ K+ }else
* [2 F5 ?! r! }+ C1 b: Z  cns_marquee.left=marqueewidth+8* \* b2 u1 _' T( u8 s* V
}4 `7 J6 k9 x, u) x6 b" f5 k
}5 d& j" v# y  V- R5 I8 C4 S4 r. f
, [( M6 F9 `# p5 L4 e
if (iedom||document.layers){
( l. {3 ?. F4 Q# \( lwith (document){
  q8 q+ ~* I9 W( H5 K7 e9 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! s: J' A5 h2 r! `: ]) f2 d; {
if (iedom){
; v2 b' N" x& _9 H5 N, O, awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! \) W' t5 B6 d4 q9 q- |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): f) |/ q; }& q2 t- }0 l2 i: L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: I% g8 _- j/ K, C, d. r6 vwrite('</div>')
7 g+ ^- \) `+ u( S}
, F5 U- a8 T3 Jelse if (document.layers){
6 y0 k3 |% |8 D) }1 |. ?) Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( b$ v$ P* G; {  }, hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). y5 Y4 {  N8 q" R: m: p# ]
write('</ilayer>')6 {5 Z9 B1 ^' o2 u: d" _$ u
}
# d- C$ ^. S* Adocument.write('</td></table>')+ h, a: `7 U/ g
}
, w% O& D  L- k- A# l" Y9 C( j}* ]$ V8 m  H$ L# r7 N/ W
</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2