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

|
网页之跑马灯文字特效
//修改宽度4 G' q% a* Y w+ q+ B" @" m
var marqueewidth=300( v2 a$ e& ^. K
//高度* H" U8 B- O' G8 y
var marqueeheight=256 ` F" |, V L' W
//速度(1-10)
* v* \0 D8 s3 {8 ~6 |var marqueespeed=3- V O4 v" O C. e2 D2 H
//背景颜色# }7 K: q# p4 \
var marqueebgcolor="#FFFFFF"4 t$ G4 W3 m- u+ F; \8 Z7 b }
//是否能暂停 (0=no. 1=yes)?4 \0 k9 I: V2 }, H- ^. [( ?
var pauseit=1; X5 O9 _$ I- \
8 w0 z: V* N9 _* ~& W6 N4 U
//修改显示内容
. n( Q& j4 Q+ A) i ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. M _5 n' Z _
0 X( u: K, \, R: [4 R( S8 Z# P) {, l; S- H2 |' Z$ h9 {
////下面不需改变////////////
0 K% {6 ]( O D7 B2 E, a$ Y: p; L3 |) Y4 a
var copyspeed=marqueespeed8 v# D r0 M9 z9 L; ~
var pausespeed=(pauseit==0)? copyspeed: 0
0 d H: K0 r. S1 k4 Z* Vvar iedom=document.all||document.getElementById
! W7 ^7 s$ e1 b- i: k1 D$ b8 Jif (iedom)
* V, ~9 q V4 @- T7 w+ o! h; Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 }/ b" H. i4 G0 Nvar actualwidth=''0 l* P0 [. ^ a2 O5 v: `+ K
var cross_marquee, ns_marquee
3 n. F3 M7 Y5 y: z( P: t7 P0 r% q8 s- J, B8 w
function populate(){2 J1 }( Y1 M/ x) b4 C! Y
if (iedom){$ F7 C* L- ^; c* o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& \* q, W/ x7 Q7 H$ F
cross_marquee.style.left=marqueewidth+8
/ z; T3 `- L6 d3 D: `! C5 I0 I8 [cross_marquee.innerHTML=marqueecontent
/ G9 \- k2 n6 y* |) u% T8 b+ Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: k/ K/ ?6 n7 U Y+ V
}* L# }/ g$ S6 b( Z" N. z y8 v _
else if (document.layers){
Q6 Y, V+ y) d5 ~1 l+ hns_marquee=document.ns_marquee.document.ns_marquee2
+ r! @1 ^! M! }ns_marquee.left=marqueewidth+81 x6 X8 B, C' b, `! w$ E
ns_marquee.document.write(marqueecontent)+ U5 }( h) s5 K8 E+ T2 j& ?
ns_marquee.document.close()
" E& S I. m7 a D cactualwidth=ns_marquee.document.width
$ |( q0 L9 e3 y}
1 P5 e t* x+ Nlefttime=setInterval("scrollmarquee()",20)
4 _' e, D! p* u. F}
- D5 G# a, n2 \' g1 Owindow.onload=populate. P+ i4 Z' Z2 V3 Q" @& w ~
) z6 F% B9 @2 t7 x# y1 T/ Z
function scrollmarquee(){
6 _* y6 G( l. V& c& [2 `if (iedom){: R/ h5 b, }2 H2 p& |! U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 D; W% P& ^& d5 v0 X8 {' X5 gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. }! N0 Q: \* t/ S8 y, _8 E$ _
else1 U+ i8 P! Q- X0 v2 r& o8 ~3 E
cross_marquee.style.left=marqueewidth+8
0 A! ]4 R v. t @, X* L V
0 z* y$ I6 y# P}
" j a d8 L2 S' telse if (document.layers){
4 y2 i2 P/ j% s- C( K' l0 ^if (ns_marquee.left>(actualwidth*(-1)+8))0 |6 u; [# j5 J* o0 }$ [! n
ns_marquee.left-=copyspeed) \# t4 s9 f. ^
else
! o1 F* N0 `- m: Cns_marquee.left=marqueewidth+8' \4 C" C% L4 q- r
}/ K2 |2 F4 t# `: V/ r1 N$ B
}
! g- A! Y( R! p+ W _: n+ s: t, \$ E! m3 w
if (iedom||document.layers){ [3 f6 {( J" {: i2 T: u
with (document){; u8 e7 I9 n* R6 L. Q, d% \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! i8 c# R3 j0 B# _) z; g/ d: P
if (iedom){" [$ V+ g+ Q! U" K/ U. b: F- g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ e6 }, N0 U$ b$ z+ z& Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 s! T1 L, C% N) s: i6 P! iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ a: l9 |5 W& k) r3 u( gwrite('</div>')
6 W' }4 i" [4 E- n}
& n' z0 |3 H+ K( P7 S3 celse if (document.layers){+ e6 F, t/ \( W, n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, F1 e2 x' u; \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' b8 ~! u) [# z& r
write('</ilayer>')
8 ^- P3 |0 {" f7 I5 z}$ }9 v; o( D) L: A2 b) V
document.write('</td></table>'); }3 A! |/ D$ N
}8 w5 T8 b. q0 o# [0 x
}
% L( y0 s2 i$ \; c2 Y</script> |
|