返回列表 发帖

网页之跑马灯文字特效

//修改宽度& W% u& e, W- r$ O
var marqueewidth=300) J' _7 H- O; _$ X1 \8 d% i
//高度
# D- W+ {0 H8 D# ?& }0 j/ E& bvar marqueeheight=252 f6 Y$ ?6 R7 T; z2 M, A
//速度(1-10)* q; l7 L2 a* n- U9 r5 W, E
var marqueespeed=3% n$ U! ^8 C+ r3 b) g+ I
//背景颜色8 r, i; H% _" D% s
var marqueebgcolor="#FFFFFF"
% b. N5 g  t) e  C% k. T/ x//是否能暂停 (0=no. 1=yes)?9 U6 Z& Z6 J4 }- N9 t* W& o& ?
var pauseit=1: N) M6 l- h8 ^# l
) z) L' O4 O) ~* [) R# t. \9 o9 \
//修改显示内容
" k( s4 x7 S7 ~* Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 e. Q1 _3 A9 X
+ H6 ], V( O0 z2 o# t4 s8 ]; C% v2 F& I
////下面不需改变////////////6 d, d7 Q# R/ `  X" V3 Q

- w3 w" M+ Z% A& T5 N# F$ }) wvar copyspeed=marqueespeed
% `9 l) H2 D& X( P7 p' m7 Nvar pausespeed=(pauseit==0)? copyspeed: 0
6 i% {" e- U2 d* ~; v! H8 A( \var iedom=document.all||document.getElementById
# W1 f2 G6 `( T3 ^6 }4 hif (iedom)
/ m( u' m2 H. y' C: Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: W$ v6 {& c5 c* Xvar actualwidth='') c' i! \$ J) T) y. i/ L
var cross_marquee, ns_marquee- [. y. B0 O7 F/ D/ i3 A

3 \9 J* a( P. \+ f. z6 m5 Dfunction populate(){
4 m* N- R+ t& J% m3 Zif (iedom){
3 @' I# D' ]+ n2 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 h0 z7 V( ]3 v9 F# r% t0 ^cross_marquee.style.left=marqueewidth+8
( n5 N: p; C# Z  j1 \. q: z$ W" `cross_marquee.innerHTML=marqueecontent
/ y& d; O5 J5 e+ k2 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! v2 U4 H/ z5 \: Y) X) ~
}
, }1 ^& m8 k* s1 velse if (document.layers){
) t& I. `5 T+ K+ z. lns_marquee=document.ns_marquee.document.ns_marquee2$ E0 d5 u. P" P2 y" e! T/ u
ns_marquee.left=marqueewidth+8
# k# `$ O8 w7 g8 ~: I& gns_marquee.document.write(marqueecontent)8 L* K. o6 O" d9 x& Y( I, r
ns_marquee.document.close()- r2 \# S& j  }* w
actualwidth=ns_marquee.document.width
+ l" S2 K( Y! B8 L( L( |9 P: ]9 |}
( P% P$ `' H. ]8 {' Z9 ~lefttime=setInterval("scrollmarquee()",20)) h6 Q& G2 D  e7 L
}
. U. e$ F* d0 d7 M( x( E, W5 Awindow.onload=populate. j# p0 b* K; W6 |/ i8 J0 D

+ G2 d2 W* z" x9 M6 R# b. t! Dfunction scrollmarquee(){2 ^, _4 g" }1 t% A- V: k* g  q
if (iedom){' K' q: h- N: T8 X8 S, u" _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 i$ C( c$ B; g& m- ?3 R% |; g8 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) X% p' V9 W2 R6 K$ l- Y* `else
* M7 d  F! O) w2 ?% X& qcross_marquee.style.left=marqueewidth+8
: _2 T9 B8 B, t' l* }( W% c; d) Z
}
+ L8 M/ w' z0 w; C" H/ kelse if (document.layers){
2 y5 ^$ q, ?9 W7 F! Z. A# i( n( W, Hif (ns_marquee.left>(actualwidth*(-1)+8))
2 Z7 F* y6 ^. u% @! A9 c: w8 [. kns_marquee.left-=copyspeed- r0 \4 P" A- w/ V: l$ p  [
else
: w3 h+ u& Y/ d' {% hns_marquee.left=marqueewidth+8  z+ B5 U: Y# n5 F& N' J
}
* u5 r! ~$ H, `# ^) R}
8 h0 r3 m, X, X% e9 ?5 u3 H% ~5 S. D7 C: |9 }! f! @# H
if (iedom||document.layers){/ m, ]( d7 O: K9 J6 q7 d
with (document){
8 T/ M$ u$ F3 Q% q) a/ v9 z( W/ Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 D* f8 u: Y1 H. S
if (iedom){
! u& Y  I0 x( l, T0 Z4 r$ zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% i1 j0 B, B2 ]* S# ~6 o6 M7 y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: [2 C: t! S6 t% w/ Q+ Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 E4 f; V2 F. D5 r8 M/ U9 X
write('</div>'). W& y$ L* f/ K* i' d$ |
}0 X- N9 i- o( ^4 U( o
else if (document.layers){8 z0 M2 n: R8 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' Y" \2 J5 C0 g: |% o& X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) L- B& ~0 U& ^( I# S2 W: n1 G
write('</ilayer>')
0 W2 J7 {" P% a' p5 E; l}
8 V. D  F: u* j: M4 G6 [9 F0 z' H4 ?( L2 adocument.write('</td></table>')  A5 M: N! o9 Y/ z% k
}
3 h$ q, K  r! Z+ k! w" b}! e, [  q7 ?9 D
</script>

返回列表
【捌玖网络】已经运行: