返回列表 发帖

网页之跑马灯文字特效

//修改宽度. i' Z- g8 Q; @# @5 C( G7 O
var marqueewidth=3004 U6 j, J, S8 n) o; W4 T  S7 m
//高度7 |" U; e0 W  e) n0 H
var marqueeheight=25
& x0 N9 }& c5 E/ ~# T! K' q. D  q//速度(1-10)% p8 J* p5 ]+ f
var marqueespeed=3( C* Z. Q, l1 ~7 j! E+ ?
//背景颜色4 w3 j; b; W9 |
var marqueebgcolor="#FFFFFF": C7 s4 v& G* P+ N
//是否能暂停 (0=no. 1=yes)?
+ M4 [3 ^6 B3 Q  N# X2 X7 Qvar pauseit=1  z' m' x/ F! d0 p9 [% G

; z! d) N$ _1 \- U/ a& K7 U: c//修改显示内容  F0 F& t% @' V  u& A/ i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 q" a9 E( S" U3 g* G( q( H1 Y( y
1 D! f6 R$ t1 N' L1 F
% |; G& Y. o& M  a
////下面不需改变////////////
3 ]  s% B/ w" s- n% Q4 W, i& s& ]( R- {2 n3 e0 u) ~4 l
var copyspeed=marqueespeed
% c& K+ T" m/ |- I. k$ O! qvar pausespeed=(pauseit==0)? copyspeed: 0
1 y4 M+ k% w6 D6 \/ ~var iedom=document.all||document.getElementById3 R6 @9 t* A. D: N
if (iedom); Y& K3 i! s0 D9 O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* W- y3 u0 E$ z8 ]/ evar actualwidth=''
' ?9 A- h. H" \9 m0 k% X2 Cvar cross_marquee, ns_marquee" }+ c1 U( P$ p; p3 y1 h

" v2 Y$ [" z! T2 n( e6 N& m; @function populate(){
/ Y; T9 {3 x, A  R. Uif (iedom){6 _# B' l7 F( ?5 l! w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 Y3 ?1 o, T& Z. ycross_marquee.style.left=marqueewidth+88 m( z0 c: r  K# R+ ^
cross_marquee.innerHTML=marqueecontent: }  M( l) m3 T: s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! d8 s! X8 b+ I+ v7 L; k
}$ ]- a4 b. J- X0 e; C# L% j
else if (document.layers){
9 L' a0 q9 H9 v" h3 ^, Zns_marquee=document.ns_marquee.document.ns_marquee2
) R' b2 j: f8 H/ d  Mns_marquee.left=marqueewidth+8) o- J) r  K/ B6 q& M9 ]0 q
ns_marquee.document.write(marqueecontent); @: d  [/ p, ?
ns_marquee.document.close()
( B+ c. C1 ]- r! E: ^actualwidth=ns_marquee.document.width
- g' c+ [: ^0 ?2 y9 B6 Y7 R}
7 b/ g. a. \1 ~' y8 f1 Xlefttime=setInterval("scrollmarquee()",20). o. o0 y; D7 x" P: D, a, }/ \' A
}3 ?' V+ Q+ n" _4 [9 E+ t5 x4 X
window.onload=populate& Z# v3 `8 \4 q6 N+ N. N. z  o

( f7 l9 u( _" y, U/ y# h  Mfunction scrollmarquee(){
3 D( R6 i% h3 x# h7 Xif (iedom){
. y8 R) _4 W/ Y1 X3 a; P- @, u- mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' j' b, N3 e8 [1 S9 C# x8 x: Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ d- m0 b* `1 s: M1 K2 D; D6 Delse( a9 W2 a: i1 ?, Y, q
cross_marquee.style.left=marqueewidth+8
5 h5 g; n6 Z0 u9 `# `/ l- R$ ]7 {1 _1 C8 p% g  v, v/ G
}7 D+ ]. T+ a" O% y+ x9 T
else if (document.layers){* z* t: J' R( \! C2 ?
if (ns_marquee.left>(actualwidth*(-1)+8))* o* w, b$ ~3 s
ns_marquee.left-=copyspeed0 k$ `: d. v& z4 Q: k* N3 i8 i& ^
else# n4 V8 ]5 t: J( W! j
ns_marquee.left=marqueewidth+8' r$ ~$ ~) g* G6 y
}
# L8 H  t. ^  a4 R+ s# u  t}1 R* S/ I7 o8 Z7 \/ ^' A5 b2 L/ |
! Y/ F( u: ]$ C/ |' _% F8 ]/ T
if (iedom||document.layers){) H; R# K* `1 z& I. f9 t
with (document){
) H1 o0 }% D! Y" cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ X' h% P" y# ^+ r. Y, v* i
if (iedom){9 m$ S: s8 E. U' B# n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- k) z2 k$ [7 j. e7 z2 m/ N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( c5 F0 P/ R* a- H) A; i2 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 H% h. ~1 I8 R$ _+ H8 A  s: T" y1 ^write('</div>')6 r. a4 u% t/ j% O! F1 ~# {
}
) R2 r/ Q0 }& g2 [- W9 @& _3 ielse if (document.layers){
# A' j2 I% @" Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) u- g2 l; |7 c, xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 o! M! y) f8 U3 b4 Swrite('</ilayer>')5 {: A, ~' ^4 Z3 R2 d1 L0 T* M
}
8 o$ o7 S1 U: p( Sdocument.write('</td></table>')
3 W' O: B( J& X. O) V! }}/ _$ n& S. l% t9 Z1 r
}% a. @/ b1 t1 T! a8 i2 u
</script>

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