返回列表 发帖

网页之跑马灯文字特效

//修改宽度* i! Z$ J7 V; V2 K: T
var marqueewidth=3002 S2 z/ W+ Y4 q% U# V
//高度
7 Z' R  e" d$ b( L% C. Svar marqueeheight=258 b5 m1 a* E+ z" E' S7 E
//速度(1-10), G, v* P" ^( o( F+ ~5 Q" X( |$ z/ j
var marqueespeed=31 D" s2 \, P% Y- y4 U
//背景颜色4 P2 D& a  _0 n5 Z5 W  p8 n! Q, |$ u
var marqueebgcolor="#FFFFFF"
/ b9 s# n! V- Y7 F2 b8 o//是否能暂停 (0=no. 1=yes)?
- @  j0 X/ Q9 ^+ @4 Fvar pauseit=1
7 ^: u# i! A5 M: ]3 H& ?
5 G; {" Z1 W$ O! t" W8 `! ?0 H//修改显示内容
2 j  }, S  A: ^$ g4 I+ Q7 c. z5 Y! fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 s" g; @" x4 ^3 J

( h4 A. d$ Z; P# _+ p/ T) G! z6 z; @% T4 \# c8 p+ C
////下面不需改变///////////// h/ ~! l* z# d! ]. d

) Y( ?' ?6 {  n. K% ?$ R) _var copyspeed=marqueespeed- V# K+ T0 z3 l7 d
var pausespeed=(pauseit==0)? copyspeed: 01 h$ {- Y0 x2 [7 u0 ]9 I
var iedom=document.all||document.getElementById
7 B3 m: t9 d% E% Zif (iedom)
2 i! u. s# O* }: `* a1 sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 |! L# S) {0 }; ?# y% tvar actualwidth=''
$ M7 J( p" E  _$ F9 q! hvar cross_marquee, ns_marquee
" {9 w. N+ v2 u9 a5 K/ |
' K  E% C4 [: ~" ~function populate(){9 ~9 S7 i2 y0 ~: ]
if (iedom){  y* |, V9 J- S- R( [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" r; G: u) f; Z# z
cross_marquee.style.left=marqueewidth+8( v. b/ m! a2 I6 R# _
cross_marquee.innerHTML=marqueecontent9 s* B7 n* a7 e' D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 d2 E& U9 c$ p) E4 C
}
7 W( d5 n- j/ l8 q* Melse if (document.layers){, t- W5 \/ ~" h8 V
ns_marquee=document.ns_marquee.document.ns_marquee2& g: Y" t7 _* T, c; B
ns_marquee.left=marqueewidth+8' @7 a1 I, a1 A6 f( K; ?
ns_marquee.document.write(marqueecontent)
9 B' Z0 ~# s4 mns_marquee.document.close()7 U- B. L& X% G7 Y8 ]
actualwidth=ns_marquee.document.width
$ W" {2 H+ q( U5 b% S}, ?; Y/ A1 M; [/ F9 @) ^7 G
lefttime=setInterval("scrollmarquee()",20)! W* }9 I; x( \
}
3 \4 Z) F2 I6 d: @window.onload=populate! f# V3 C; ~$ T8 e1 k7 q/ v8 I; B

1 z- m6 j0 i' n: {function scrollmarquee(){( d% H3 R1 k$ o  `# F2 b( c: n
if (iedom){* p1 z+ Q$ D/ H0 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" q: q& P- j& l$ n! ^& e1 s7 L+ ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% S+ L0 p1 n8 h6 K( i! Pelse
1 O- ?$ A; B. g$ O+ T$ R3 {cross_marquee.style.left=marqueewidth+8' Y+ ~7 I7 \/ R4 C% n# A  b

3 V* \0 N6 W8 Y, y4 a, T}
! W$ t- B. L- o1 T5 \else if (document.layers){& P& B. k$ a- M7 T* b
if (ns_marquee.left>(actualwidth*(-1)+8))! J( J. [( F$ t% i5 v1 W' }
ns_marquee.left-=copyspeed
) k! U4 ^% T% T* Xelse  }, d+ M' p) [3 m% n; R
ns_marquee.left=marqueewidth+85 l" L- h; K: R! X) Z/ }4 Y* C
}- A; q" Y1 w! k& }- Z0 k. O  n/ V/ {
}
) r+ Y3 B% O3 T" Z0 u# a8 C. O9 U/ V! X& {- `" z7 b& Y6 u
if (iedom||document.layers){- Q7 \( E; t/ a! D- a
with (document){
7 C. P) P# d9 B8 ^' E* k2 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" M3 r! ~+ E; M  ]. S1 B# S
if (iedom){7 X7 e; n1 p3 r0 g& T4 w& @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 [& O7 e% S3 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 z+ s6 a/ m5 |* s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ n; l. N8 i% g! A7 N, v# F
write('</div>')  ^8 i* s8 Q. w
}4 f  o- v- t$ w; p
else if (document.layers){
8 ^) e5 U, \0 L/ W0 R5 vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ c- \  @6 _1 a$ t) Q$ O" `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 ?: J% N6 O" u1 n2 ]; D  wwrite('</ilayer>')) @0 f5 Q5 w) a9 K' ~
}
6 j4 S8 M3 U8 Hdocument.write('</td></table>')
& S. E: C, G# \" b/ }% ?3 _4 b}+ Y  E! h& v$ A
}: D+ N) F, A4 `6 l+ N
</script>

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