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

|
网页之跑马灯文字特效
//修改宽度
8 V2 O o1 T4 _' v4 Jvar marqueewidth=300
|. \( q, l) n" Y//高度
3 u' r8 p; W2 a# N$ m. Rvar marqueeheight=25
~* I. E, U6 Z1 M" j7 u//速度(1-10)9 ^8 P) s: r; S% l* Z
var marqueespeed=3
- ~2 r! s b) u//背景颜色
J4 M- n! c+ B9 J* g! mvar marqueebgcolor="#FFFFFF"( b* S f; A% ?8 Y7 c& }7 R
//是否能暂停 (0=no. 1=yes)?
2 d1 g4 h; p1 z$ w; Y3 [3 K- Yvar pauseit=1
/ U6 P4 l* o& i0 X5 r8 e3 ^* y# ~- V, H' y( g* P
//修改显示内容
& d1 n+ J7 f" ^/ kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 F/ {% b* |5 F( [7 T9 P2 Q5 |2 E2 S0 X
, g& Q, E9 Z% k/ O U' ?# W
////下面不需改变////////////
' |: w% b+ k- i5 N
+ g3 ~; a1 m5 Wvar copyspeed=marqueespeed: \& z3 |# B$ D5 n8 ]; q( L1 u
var pausespeed=(pauseit==0)? copyspeed: 0
7 ^: }* A4 |6 \* n: gvar iedom=document.all||document.getElementById
! ^$ Z; _' k. d U9 i# Dif (iedom): F* f7 H; N8 F' ?9 K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): A; D4 i' C+ J3 t5 A7 [
var actualwidth='': p- Y, f( X W7 Z u- z @+ h# W
var cross_marquee, ns_marquee$ W. \+ U; f1 h# L
' I/ F: D' Z, J
function populate(){, y( o- `; {6 r
if (iedom){+ y" N6 D: y X9 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" m' A N* ] [5 Xcross_marquee.style.left=marqueewidth+8- h( V( Y; q3 V- K7 s4 [
cross_marquee.innerHTML=marqueecontent/ P+ S* y* e& f. K- m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 `* X( M- T9 |
}4 z8 F. \9 O0 a
else if (document.layers){
/ ^6 T7 E5 T, D+ `3 s. t. P, fns_marquee=document.ns_marquee.document.ns_marquee2
/ A5 q; r. J0 W% T4 o; j5 `ns_marquee.left=marqueewidth+8
) K# J- W/ M- M; J/ ]1 v. @. Jns_marquee.document.write(marqueecontent)* c0 }# \3 z$ F/ `
ns_marquee.document.close()
7 Y7 c5 U) M; ?9 k# e0 D( @actualwidth=ns_marquee.document.width3 b& t. l% x& u6 x" v
}
0 |5 W, M2 V6 c- s5 Klefttime=setInterval("scrollmarquee()",20)
N, c3 j7 o. z}
9 n! G% [+ g6 }9 R* ~window.onload=populate
, l8 h# Z/ J- E# `& R- s- G2 r6 j0 {) I, v
function scrollmarquee(){
6 ?, S+ a/ h% ^" g0 \ J3 y; O; Pif (iedom){
. G) K: q9 _% Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 ^2 K! S/ p1 R0 ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 c; }& e6 C, d3 b% \/ ~' s
else+ ^( A3 R& b& o8 r2 K
cross_marquee.style.left=marqueewidth+89 b2 g3 ~, {/ W* f( |
5 @9 t- j9 a/ t# [3 ~$ s8 h+ g
}% w2 c- H- f2 |9 ?
else if (document.layers){! V+ O) q4 b7 V
if (ns_marquee.left>(actualwidth*(-1)+8)): l% N! w$ E# t- y m @
ns_marquee.left-=copyspeed
( _6 Q. }! t/ Z# F _8 Jelse
% f" C2 Z% A. a' k( b% M/ J4 ons_marquee.left=marqueewidth+8+ Z1 u1 C; W: Q' G. a* o; c
}5 {4 f: Z! j* \8 y# K+ X3 j2 k" a3 ^
}
( V) e8 ]! P- u. e) v. ^. z! T% X0 w0 ~+ |: x; w' p
if (iedom||document.layers){) T7 v5 e7 |7 B8 l1 d( J; F6 M
with (document){3 Z$ V* K$ E5 [; t9 V" l+ b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' Z+ U* X* y5 ^' J# ^) g
if (iedom){
/ F* v+ ^4 G8 D4 [3 t$ w; K+ }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, h+ Y$ _1 }+ m$ F4 ?2 Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). D3 ~. B9 J4 Z. g2 h, ~7 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. Z; P( n3 U1 qwrite('</div>')
; c. l: p& ]8 Q4 ?) n2 p2 @4 A}
5 g3 ]8 d+ p7 d' r8 ^else if (document.layers){
$ N. P# x: [& O' Q5 Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' M6 \. G( ?0 `0 D/ `$ F1 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# `: z" a* ]8 w9 Y2 W0 fwrite('</ilayer>')
: j8 E& ^) j- t8 U( U8 C. l" r# q1 i}" b3 l: i" N$ z0 r! d0 V, X
document.write('</td></table>')
- f; j$ U+ p& U: L4 p3 }}- m: d( b ^' u% W% N I; I) E5 A. H( a
}! ^1 I9 D5 F7 M9 [. ?/ D }
</script> |
|