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

|
网页之跑马灯文字特效
//修改宽度1 ?$ ?4 ?# D7 j% T
var marqueewidth=300
" B7 G" t) z- `' o4 b* s5 t3 X//高度
, t2 F( x9 J( L Yvar marqueeheight=25
9 q9 i9 T7 w2 W1 ^7 ~% z& m//速度(1-10)
$ L4 Z: h$ G* U4 W f' u" \var marqueespeed=34 M1 [* {) }, V3 d" |2 a- B
//背景颜色9 ]& h: O" A1 n# I
var marqueebgcolor="#FFFFFF"
: u" N! ~% k+ z- f% @//是否能暂停 (0=no. 1=yes)?% _- q& P2 j" ^$ a8 t7 V
var pauseit=1# W2 A- \! o# e; d( Q$ {
% F6 \/ O! Z6 D9 O d- L; X
//修改显示内容
+ g( F) h& g/ Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ D/ H+ ?/ e- _4 s8 N; D4 g$ H& K6 `! T7 [( {/ q+ A
- ? l6 G& @7 I; t
////下面不需改变////////////6 j% ]0 L/ r' ~' _9 L j8 m7 R
8 L' y& ?8 [. z. w" ~' ^ \var copyspeed=marqueespeed# y% }* I( ^2 U9 K- q6 N, ~
var pausespeed=(pauseit==0)? copyspeed: 0; y8 R3 B- Q4 X0 W( X- u1 y
var iedom=document.all||document.getElementById# ?5 J8 u0 j! K+ o, v+ w7 ~. `
if (iedom)
: \3 L9 {+ ~/ {: Q+ M# v# \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') ?7 K; s4 B& P2 I# P" J" R- q5 t
var actualwidth=''
0 \6 p5 L: f2 w9 nvar cross_marquee, ns_marquee7 |+ |8 O* r% R0 `4 O/ j: ^: a3 I
5 T1 x) R: U/ D" g# d- Z3 Mfunction populate(){
1 q3 }" k$ {6 E' sif (iedom){
1 U7 U) w$ w4 o p/ b' Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) k- C1 h2 g; g7 p
cross_marquee.style.left=marqueewidth+8) U; C; k* I$ F' L9 s
cross_marquee.innerHTML=marqueecontent. Z( Z' g# ?! b" f5 J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( I: O( ]& v3 j" ]; h6 Z- G9 u}5 ]8 V* g3 e& W
else if (document.layers){0 q ]: {$ r( k. O
ns_marquee=document.ns_marquee.document.ns_marquee22 m p# o. u# \ h# m5 Q% ^3 k+ \
ns_marquee.left=marqueewidth+8' y, y6 `* k" }
ns_marquee.document.write(marqueecontent)
) `* G4 h& w% bns_marquee.document.close()
4 F) E, E5 A/ g; Yactualwidth=ns_marquee.document.width- t! s) @4 N% e* }% I. t
}( x! {7 {) B3 y8 U( [# m
lefttime=setInterval("scrollmarquee()",20)
0 a" M; ]# [2 \+ P}
2 W0 V I0 K6 b" X {# \window.onload=populate
. o/ l' ~8 K) d. F/ k# V4 I6 g1 o* P% y* v! w
function scrollmarquee(){, [! O# r2 Z- J% a
if (iedom){/ n$ Z9 s2 P0 G s; @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) j1 _; F( U4 f8 o' E1 ?4 q o. J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 p0 i* `, f: K' ^+ Delse
, j6 }# y( w, _# B" ?; bcross_marquee.style.left=marqueewidth+8& s! c7 y/ ~" C0 w# F* ]
1 M" z8 q) n0 s3 Y% Y3 Q) o3 z
}, r/ ?. D) @. ^# B
else if (document.layers){
3 }5 b* E: ?& ~if (ns_marquee.left>(actualwidth*(-1)+8))% P1 q) r! I6 c& z
ns_marquee.left-=copyspeed
& u% @' Q j2 E# t5 j* o ^else: B6 ? O: V. i0 a
ns_marquee.left=marqueewidth+8
8 w0 I$ k! h0 Y* p}2 n& `: l' p3 w
}( r, y7 A- t; ]
8 O; i& E% d- |; _2 k! g
if (iedom||document.layers){; Y7 B9 `; ?% O/ m& e o
with (document){& m# l8 x, j. `% M: e L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- _" o: v; p5 P7 T* l# z
if (iedom){
. L1 p/ p, O6 R% ?* X& Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ z! [0 _2 J; }( G& g; T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) |$ P& f! v7 k9 W- x0 Q# C5 Z9 N8 W" P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 {' I0 T' _; K; ], I
write('</div>')" B3 l; r Z0 Z. ~; x7 P0 `; e1 r1 w
}
$ g" z$ O$ [) V) U2 Kelse if (document.layers){
0 G: t" K- {7 ~8 f( Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ ]' i+ g- Y0 X( r+ @1 h# xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ p" h& S8 l; b- i6 ^9 ~4 ~
write('</ilayer>')* ^7 [* J) q) s8 m/ Q- j
}# |2 R2 e: v r! H
document.write('</td></table>')4 a3 ~$ ^3 u. G9 A+ U, @2 ~/ f
}
: |1 e/ `/ }2 p3 j% ^}
, o9 L8 K# l7 ]# I! {+ l [</script> |
|