返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 U$ O7 g* V" O1 i/ G/ ]
var marqueewidth=300
: u' `7 o" |  ]0 h  [//高度; H' i, y7 m: Q/ v; U
var marqueeheight=25
4 p) r: N2 _) z//速度(1-10)
! R4 ~8 p' j! x0 Kvar marqueespeed=3
! w9 V4 @! B8 n: c& B//背景颜色
3 [' V) f& w4 L1 C: B3 Tvar marqueebgcolor="#FFFFFF"
; z- Z6 e) K! J) r//是否能暂停 (0=no. 1=yes)?
5 @/ Q+ Y5 `  Yvar pauseit=13 e! c5 b# e; {; u8 g0 k

6 H  @/ R4 y5 `  m/ P//修改显示内容# Y3 T: {/ \4 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* e! V0 ~9 Z  B1 }
0 R! B; e3 y2 b7 P: u" i- Y$ U
2 `, U9 {2 o( k) }* o( K( I
////下面不需改变////////////* ], x4 f1 v9 ?& S9 X2 O' m
: f$ c4 w* d4 C( ^( f- C  P7 S
var copyspeed=marqueespeed2 v2 w2 d9 k# u9 K# r
var pausespeed=(pauseit==0)? copyspeed: 0
" ?% U3 H, q9 [& |5 j# Mvar iedom=document.all||document.getElementById
2 Y/ h" r4 O# e1 x; k$ b$ h' tif (iedom)
8 v  R! ]2 ?/ D* K% N; `0 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). U% m" h5 q5 w* D
var actualwidth=''
' E6 V# v# A' l' N, {6 Y  {var cross_marquee, ns_marquee
" a) k1 n! |' d: D9 p
4 V* k# n) B5 `9 Q, k* J2 D+ Bfunction populate(){! x/ u& c; B. q2 J* ]% D
if (iedom){
7 V4 k( V6 G" B( X! Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 g! x1 p& l2 x! K" q  A) icross_marquee.style.left=marqueewidth+8* ]# z* x5 U/ J1 T! Z4 H
cross_marquee.innerHTML=marqueecontent3 e6 K( [$ [, Y3 b. m, t2 c/ p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) Q# l' C) U9 D2 X6 l7 e# P}, m: P  P: d8 B. O8 _
else if (document.layers){- Q1 s5 _$ L8 W
ns_marquee=document.ns_marquee.document.ns_marquee2  ?( S- p. l- i0 d2 P
ns_marquee.left=marqueewidth+89 i4 W: @$ C) h/ C4 z7 `& y( U
ns_marquee.document.write(marqueecontent)
; D( c: K2 n' b* ~; H. m$ R' ins_marquee.document.close()
' P& z9 T3 \3 G# O# \$ wactualwidth=ns_marquee.document.width2 {2 {/ |; k+ B5 [
}
! D4 F* l3 G- e) t1 Q* \& alefttime=setInterval("scrollmarquee()",20)
) p' k# w9 ~7 k- ^! M}$ q1 W' |# F' e7 ^# h# |: F
window.onload=populate. s8 U7 y& g1 {2 h: H; A
& f" {+ W9 x5 U7 [
function scrollmarquee(){. z& V' p1 ^0 m3 n7 U
if (iedom){$ Z; R+ x0 A) }$ l. {7 B2 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 ]  d! ^) v- }8 G7 J: }0 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 {( }/ ?. r  _
else0 v8 R9 H4 g, \
cross_marquee.style.left=marqueewidth+8' t( N1 P: N: V$ v# w8 D$ H

) h% A1 `! E$ q: O}& Q1 v# G1 B0 u
else if (document.layers){
4 b/ z4 O5 i' Z9 @if (ns_marquee.left>(actualwidth*(-1)+8))* R: S" g# c' p" F
ns_marquee.left-=copyspeed
: ]! u8 N: j; j+ F0 {; yelse
% ~+ Q0 ~3 g! O+ m' ~8 Cns_marquee.left=marqueewidth+88 d- B, I6 B$ g, Z
}% \$ t0 N, G; [; [6 ^
}
/ G- Z. [; M0 ?. d' T) J2 o  X' ?% p3 I
if (iedom||document.layers){! u/ j4 p; R0 {  G! q1 [. `: h8 Q# d6 k
with (document){/ z  {+ P% |) J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- Z: {3 h9 ]8 X3 F( G3 c8 @if (iedom){: E1 f" g2 E# Y3 ~. E$ r6 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ X* f% \8 M. d) h/ K) a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( ~8 C0 V/ |  ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" |2 w; ~* ]) V5 `) o
write('</div>')
1 d/ ]. p0 X4 ?! v5 `( e+ [& o}! h7 q' {) Q. x# Q5 T1 B0 ~: I
else if (document.layers){
" _8 T2 u. L# Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), X' O: O! i* e/ F' v1 d4 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 k4 F7 g- l. N- s4 u4 Owrite('</ilayer>')! K5 ~- U9 B" O) g) E. U1 g
}" G- m8 G3 H9 x* H' _. h3 M
document.write('</td></table>')
+ q- g/ `3 h( p/ ?}
, {* c. y' x- b4 ?( x* ]! j: U% C& a" Z}
& Z1 w+ o, |( Z8 N</script>

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