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

|
网页之跑马灯文字特效
//修改宽度: O5 b1 R$ J4 H" b
var marqueewidth=300
5 l {9 \- \: G0 D$ u% ?/ R//高度
0 ]2 h8 Q. U3 y/ w- J7 m% n( B+ Xvar marqueeheight=25
" y2 G% [8 {( k: g G//速度(1-10)
5 T+ M) F7 H) m% e) f( h; Lvar marqueespeed=3
, ]" s+ L. ~4 J0 m% @+ _0 h* z) U//背景颜色
, Y1 m3 ]. L: k# O( cvar marqueebgcolor="#FFFFFF"
7 {( \# {: o, x& o( K' g//是否能暂停 (0=no. 1=yes)?
2 E9 B7 M# z5 d m- ]. D5 Vvar pauseit=1& } P3 ?" b( N$ I; Y
) z. f' |" P$ a$ G7 b" A5 O$ Y8 |//修改显示内容' y3 n: N* N2 J* n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 S6 L" i" {8 H" p2 i) G3 ]5 i; G [
" V8 m! N3 Z" v
4 T6 _, Q6 v4 Y7 d; \; m7 m! {////下面不需改变////////////0 w: s# m- h9 e/ ?& r( b
% I! F1 R. c, h8 A
var copyspeed=marqueespeed
1 L4 | ]0 F& L1 |! Q2 d+ [var pausespeed=(pauseit==0)? copyspeed: 0
+ o5 ^: x' @3 f( q; W7 P" wvar iedom=document.all||document.getElementById9 g( m3 j% A! b+ L4 C
if (iedom)
: g5 m7 D8 U* l6 }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ D( }4 u6 d; qvar actualwidth=''" ]$ M& b7 N! K8 b, q& t
var cross_marquee, ns_marquee
' [( R! W: l+ x! p. b/ L3 S4 K* F7 U: L& i
function populate(){
' o& V7 F; i5 k. Dif (iedom){
( n* P X7 h' ^3 A$ E# Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; p" w" G& ?/ K* W
cross_marquee.style.left=marqueewidth+8
T A! I( \9 }7 I1 ocross_marquee.innerHTML=marqueecontent5 u' e& \9 R( _+ g. F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 W+ h& h% k+ H, K3 ~- X% k
}3 l2 O9 K2 ?$ h' x) u
else if (document.layers){
6 B" g6 {9 y+ r3 l" K5 G4 tns_marquee=document.ns_marquee.document.ns_marquee2; y6 f3 W" m( u$ }
ns_marquee.left=marqueewidth+8
4 L: x/ \9 w4 P; tns_marquee.document.write(marqueecontent)
3 Y ]+ ~9 d( [0 K5 z/ H$ w, Ens_marquee.document.close()
& i' x8 {, z2 `2 Vactualwidth=ns_marquee.document.width7 D; l9 a$ N; v; |% H
}
$ a: u4 t6 U" M0 I$ Blefttime=setInterval("scrollmarquee()",20)$ Z' f4 N1 L) k7 Q3 d
}
3 F' W! h7 E% k9 a/ lwindow.onload=populate
- x6 l$ A0 I- Y9 H H5 ]2 T; K* ^0 }9 i# q6 I( S t
function scrollmarquee(){
$ x$ x' Q, W% y0 Dif (iedom){
7 @: O3 U' A' Y: gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- A( e2 g; S* c, i, R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: q! Y: [. |4 U4 y: i1 k7 k
else
: h0 M* ~7 l7 d |8 kcross_marquee.style.left=marqueewidth+8
: D9 }! M1 G, B. B7 x
6 S2 A7 P5 t) c/ I% ]% L# W}/ w# Q2 u( F2 N- \0 f/ w' j9 C
else if (document.layers){
4 E b3 l; A! |9 p( ^0 }if (ns_marquee.left>(actualwidth*(-1)+8))
. B( J% z" j* M7 @4 K) ~* u8 vns_marquee.left-=copyspeed
1 Z! I" Q: ?7 y% eelse+ `9 L' z: H6 ~1 B1 n
ns_marquee.left=marqueewidth+8. B* g: f, X; C$ @! n7 t
}
. { J7 i3 c& y}
' e9 l5 ~% ? Q* g' }( G) U; |7 w/ H& G* g8 ~
if (iedom||document.layers){1 _" q! O8 d M" M: T
with (document){+ _, Z% i" [) d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! P: \' S) f7 k) @
if (iedom){7 {) e6 M4 l: i R p+ I7 f$ k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). U) l2 w1 T" W( h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 s4 `* y4 W+ \. N ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 k) [. G7 |+ n! x( `" ]) w
write('</div>')
- m1 a3 S7 K3 |- n# J% |( {; F! O}* _: k1 P+ @; G( z
else if (document.layers){. ]3 C( U3 A2 ]* C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- F7 B; b& v" g0 S: k+ b# d* W6 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 N) P2 n6 l2 M4 C6 J2 lwrite('</ilayer>')
* K8 T' B: l+ Q, N- }0 y/ y8 B}* S9 C! ~: p9 ]# q5 x
document.write('</td></table>')
( O0 F0 D: P' [. j& r5 a}2 x0 _' w+ F' f) {2 t
}( Y: | u+ l1 s8 _ v
</script> |
|