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

|
网页之跑马灯文字特效
//修改宽度* P/ T& M& U8 V; o) J$ B
var marqueewidth=300$ g' D u* |+ Q$ A( d' p3 k" Q
//高度
2 r! Y X7 E8 ^, x* J" x% Ovar marqueeheight=25! L1 j/ E5 j/ l) D; j) f d5 R. n& Y; `
//速度(1-10)
' ?$ U6 m" B! X7 L% y* l* fvar marqueespeed=3( J8 e: @; g4 H+ L
//背景颜色1 |' d& c6 u7 m+ [$ ~$ w9 ?1 c; Q
var marqueebgcolor="#FFFFFF" K; \7 R2 p3 E
//是否能暂停 (0=no. 1=yes)?
( U8 H8 w* S: m& V* E9 a* `# kvar pauseit=1. x: P% J F1 A2 k K1 t5 @
. e' G: i! ?( Q
//修改显示内容
1 ?3 |1 d& a! f/ E/ O h% \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 [2 q( f9 `$ i, r( X! i
1 M7 b @3 T- t% r6 z4 A/ o- T4 X0 F+ g1 u6 J: p
////下面不需改变////////////
4 D7 ]( \( [9 |& ?5 f1 v: e8 T
" I! _9 ]$ _' m5 @var copyspeed=marqueespeed9 L5 {, J* r+ S: O
var pausespeed=(pauseit==0)? copyspeed: 0
5 ^1 Z5 ` V4 D! q7 O: I! K+ Fvar iedom=document.all||document.getElementById% ~: c0 Q8 \5 {. H" O. L7 i, |
if (iedom)2 [( ^: {0 k X8 v0 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* k0 I) K3 Y, f/ ~" D
var actualwidth=''' ^& V% y7 A: Q1 b1 h$ i5 `
var cross_marquee, ns_marquee
+ k7 Z8 z+ H+ _) P
. U2 q7 F+ g9 afunction populate(){- I0 t. j$ L G( E
if (iedom){
3 J5 y' C+ l2 _5 O# @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% m; G. \/ e7 h9 b) Ccross_marquee.style.left=marqueewidth+8 Y" r9 w2 s5 j, _* w
cross_marquee.innerHTML=marqueecontent
/ i' Q6 h) H0 H; Y: V) \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 }( ~. x* h1 {5 E}, k6 n6 f: o! }; i$ A+ a
else if (document.layers){
4 x6 U T8 ]& C+ `+ l- o- Y9 Fns_marquee=document.ns_marquee.document.ns_marquee2" _5 K& ]& M/ R5 L
ns_marquee.left=marqueewidth+8
2 Q0 T1 X9 a* Q" k; u! Lns_marquee.document.write(marqueecontent)$ O& a1 s# s* w3 R! M# ]! E
ns_marquee.document.close()
% t& C) t5 T' A2 b( w$ ]6 Uactualwidth=ns_marquee.document.width. y ]1 B& x D# d. x" G8 O
}
' {1 `, N) Q5 M( g) @; Q" zlefttime=setInterval("scrollmarquee()",20), q% e6 H* U4 U1 I+ Y
}& `: P3 J: G0 }4 o1 I$ |; z: B" s4 T
window.onload=populate
# `/ A' r: f! G% M9 y7 U) i. W) H# V3 Z# X- |
function scrollmarquee(){
) J6 G* v u0 N$ v# x+ G2 Tif (iedom){
: ]' F2 }6 i" n# g; ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* @* z% p% E2 E# J4 E3 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 t; j. w& b4 K j$ }5 \
else
* I* R1 h" e4 A! C4 J2 mcross_marquee.style.left=marqueewidth+8( p. L- N$ l6 S
/ c/ H) }1 B* P( u1 V
}
( J( |& L/ s! K0 V$ H: K' aelse if (document.layers){- P/ w4 Y5 P6 N4 F8 L
if (ns_marquee.left>(actualwidth*(-1)+8))# L/ d% u/ g$ `& { `% s
ns_marquee.left-=copyspeed" }) I+ N: u& C, X8 `
else6 o& s- E0 O4 C: W1 M, j5 y
ns_marquee.left=marqueewidth+8
% G5 z; i* z- U e# m, f2 C/ g}& C2 h6 {& P @0 V3 b2 {% H& n
}
$ Z8 o3 ^5 J2 s9 g! J3 ^; ]7 w# C$ [' S9 k8 X
if (iedom||document.layers){# j5 B# X7 m3 V p& X' d: q, B
with (document){
$ H) {" Q1 R% l' V# X1 Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, M5 d2 a& C% d: {3 j" X! n6 y& jif (iedom){& L# `4 e9 i& a# _% |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( ~' `' y( V7 g: t$ p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ R, Y) V. z+ t5 @1 y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* E% @5 }- D4 G9 _
write('</div>'), f3 {7 ?, Y/ P, h
}% f- F6 ~7 s: _1 k
else if (document.layers){
$ n j6 U2 e+ [5 i) Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), a* y+ J1 N6 `0 V' m2 s# `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 o v0 D0 T) K. [) H
write('</ilayer>'), \4 n" V6 T+ i3 {% M) Y- n
}5 `5 P8 B$ {; i0 ~2 g
document.write('</td></table>')7 ?3 o9 [7 T) u0 ?4 `) q
}
2 r% F- c7 ]! a}( b7 d' y6 E3 y6 z! O8 X
</script> |
|