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

|
网页之跑马灯文字特效
//修改宽度
) _& C/ w- s: J4 S$ Avar marqueewidth=3008 u+ `! p' M; a6 k R
//高度
4 F" [9 I% {/ |+ W& ]7 F+ Gvar marqueeheight=25
1 P8 r) k0 j7 [- \* W( g//速度(1-10)
- o% ]3 n) `7 Q+ _) z6 Y: U$ k5 E/ Kvar marqueespeed=3
- ^. r' u6 h2 O# r7 U//背景颜色
& Y1 V I4 M8 |0 _3 S' y$ \var marqueebgcolor="#FFFFFF"! {0 J- U( {9 B3 O9 `
//是否能暂停 (0=no. 1=yes)?
# {: \8 g/ \/ W6 m0 l+ y, ?5 hvar pauseit=18 {! O, k2 A3 v" |2 s5 L
" {8 @, }, T/ |//修改显示内容1 D' J, P( t$ n; w& V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( u, x& |4 x" z% K# g* U& Z1 `! u% c0 J: @
- Q# o L1 p/ ^8 `, c% g n P. s
////下面不需改变////////////. T) E0 f; b" U: e+ A6 E
: C' H# j2 K! \# {' G5 S. nvar copyspeed=marqueespeed
3 R* T. w: }% I' C) Vvar pausespeed=(pauseit==0)? copyspeed: 0
% N2 |6 I r4 u1 |9 h% J) M' }var iedom=document.all||document.getElementById, z5 Q6 V. W3 l2 u6 K Q" B+ j
if (iedom)
0 U7 f, Q7 m [- }' wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ j9 ~: V! s# Q5 `8 x3 U' U& fvar actualwidth=''
- Z. |2 T2 a5 e* e8 j( Nvar cross_marquee, ns_marquee
' D$ n4 ^9 q) H n2 ]" f8 |, n/ t9 P+ N* G% r
function populate(){
4 l/ v% E7 ?. c: ?7 l, Oif (iedom){! h9 ~& v! M& D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% x! A6 V6 x/ h! ^0 `! Q8 { R
cross_marquee.style.left=marqueewidth+80 z4 t5 i+ {" d8 Z8 \1 I! G
cross_marquee.innerHTML=marqueecontent
+ Y, K. |( n1 F2 s: G; H7 u( yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 O) s% ?( _; H9 w7 C}% o3 x3 L8 }, ^5 E9 [6 J6 T) \
else if (document.layers){9 ~9 P4 F. s4 u5 B1 q
ns_marquee=document.ns_marquee.document.ns_marquee2
9 D+ @9 A* a. ^8 J. Z7 b4 C& W: ans_marquee.left=marqueewidth+8
) I- p. q/ a! ~ns_marquee.document.write(marqueecontent)
3 n/ B* d% g3 B5 m# sns_marquee.document.close()
6 }, I- d V8 Q6 \) Zactualwidth=ns_marquee.document.width3 K/ B0 Q( K, D8 h! I
}
8 W1 W, F9 U! L5 [lefttime=setInterval("scrollmarquee()",20)& F6 `' ?) L% n7 z q
}
- P6 c3 E; v! e$ ?( p; c( S! V, Y) }window.onload=populate
! F: k+ u- B) y9 v' \- l+ s* M9 c
y! | y ]# U7 f( t0 Jfunction scrollmarquee(){
0 h9 y" |8 }$ s7 v6 b+ q1 Mif (iedom){$ u" D" Z8 j& j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) b; a4 I& h8 t3 R2 V/ D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* J3 W; O5 F6 ^; F2 [' {else( h7 q, L- B- B# d! n
cross_marquee.style.left=marqueewidth+8
5 m" x* B4 P, w Y$ c* b
# ^5 _( q2 c, X- o1 K}+ b7 H) q0 ~2 B: s# `
else if (document.layers){
6 J# \: M. {: o4 V) @" l. Dif (ns_marquee.left>(actualwidth*(-1)+8))# v7 z- S( u) v C$ L5 [
ns_marquee.left-=copyspeed6 O" d# _: w y8 H, P
else
9 G8 U; u# ~- d, Q1 Q( ons_marquee.left=marqueewidth+8: l, N/ E0 P% b$ W$ ]5 X7 ?
}
" v6 ?9 ^- _) P) j) V}
0 `+ r% N; t0 }: ^- o2 U
5 @; C& I% g; M! H3 Uif (iedom||document.layers){
: B6 x4 @: B: ^' I4 N6 ]' a, K7 R, ywith (document){
. b& E6 ?* I( Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: x, w" E4 H2 N9 y# i& g' Uif (iedom){- D4 y# W8 T1 w. G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 r3 J9 U) f) m1 h) ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). G, y. S8 S4 K, j& i5 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 w! Y0 R" ?9 K% b8 ~- Hwrite('</div>')) B' K' Q; w6 ~2 j
}$ W4 D/ E5 H! m5 n( p7 z+ U
else if (document.layers){5 Y/ ~; v4 ^" m# V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! @: z2 Y$ i* h5 ?; L8 b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ b Z% c. I. ^7 f; H
write('</ilayer>')
9 T+ X: _; k& R: g m}
' d' a2 Q! T% d# k7 Zdocument.write('</td></table>')
( b' a; p$ S# x}
* L3 v- W) F/ `: S" r}
. z1 G: D) ]! F# U</script> |
|