返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 C4 }# c0 h' W& j
var marqueewidth=300
! ~2 |4 P8 W1 o. j- l//高度
3 i* s4 w+ b- N% N4 j9 S, a$ L" I4 gvar marqueeheight=25% n- T# @) G, ~5 @4 h7 ]
//速度(1-10)9 U( b, e6 e8 i8 @
var marqueespeed=3
% N# U% J' x1 Z' |4 r0 O//背景颜色
0 Z5 {2 {* Z' ?8 M9 t1 Qvar marqueebgcolor="#FFFFFF"; B8 p" k6 U# x, S+ v* T- D: [6 V
//是否能暂停 (0=no. 1=yes)?
# s: V8 b( v# U: nvar pauseit=13 N* p7 I/ `1 c" F
3 y% K5 L. i0 D4 k& j
//修改显示内容# D% R5 I1 {0 j; |) {, l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- W5 g5 t7 ?* w
- t' u' O# M8 M' v/ r& |

! W: i0 h& |/ s////下面不需改变////////////' [% D( u& h; W
2 ^  |* N: {' ]) q) T$ E
var copyspeed=marqueespeed
. R; T4 J; M' k8 m# r) a4 Q! p. o* Hvar pausespeed=(pauseit==0)? copyspeed: 0
: k) H' L: ^4 X* Rvar iedom=document.all||document.getElementById
3 q- G3 j; K* `  d7 ]6 T) Hif (iedom)9 p8 ^; J3 _3 W8 G1 i" F+ E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& ~- H0 n# _: ~8 I2 yvar actualwidth=''
" }" }& A/ N. {$ X2 y, A7 A% [var cross_marquee, ns_marquee- B$ L$ v9 F6 ~1 }+ z& @

& p9 A2 Z; h6 S: g6 @7 M0 h4 Dfunction populate(){( V- u& r6 F  p- o- e& F6 |
if (iedom){$ D9 E$ t8 x7 K' V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 P: P. g7 w* ^' [3 G+ F2 r2 a7 \cross_marquee.style.left=marqueewidth+8
  J; R# \' _& y6 m1 x. }cross_marquee.innerHTML=marqueecontent
( p& D4 L& Q7 P5 g( yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- Z# x2 p+ o. O8 I* A( I. r}
- h# B+ h2 l& R$ [' j& i5 ^else if (document.layers){
5 I2 `& h8 ?: mns_marquee=document.ns_marquee.document.ns_marquee2* A, {( B5 t' t% h  [
ns_marquee.left=marqueewidth+8
5 m' z+ w: N$ s; ans_marquee.document.write(marqueecontent)# b) G# R1 r9 c( O/ e5 g! C0 H) M
ns_marquee.document.close()7 @3 N+ ~  C/ f8 N
actualwidth=ns_marquee.document.width
( ]& y6 z( D# J: ^7 K- K}# q- j, p& Q1 M( r3 Q
lefttime=setInterval("scrollmarquee()",20); h/ z6 g$ F9 T2 {; T+ |: e0 I2 i
}
7 h" p# f6 i1 n. _  swindow.onload=populate
. ~, n* K3 ^$ M* {, J) E6 g& q, D9 x' C5 p" ?
function scrollmarquee(){
. [; R, y, g1 Uif (iedom){0 }0 A4 P  \9 F8 A. N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* \, x$ W5 V# e. D4 ^+ ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ t) u9 j( g, m+ j: ]2 U( Zelse
9 V# @5 F/ L; j" N: ]cross_marquee.style.left=marqueewidth+8
0 f% Q! ^/ |# x$ _4 I/ r; s5 H( b& K
}
& K. q$ @1 h- J1 Welse if (document.layers){. S* D: H1 _+ W
if (ns_marquee.left>(actualwidth*(-1)+8))1 Y+ p. c% \/ N  K# C
ns_marquee.left-=copyspeed
  f6 h) E& u9 H  ^' q/ Z1 o( x& Eelse
1 Q, [9 J8 v( z/ C/ Uns_marquee.left=marqueewidth+8: t, d; Q* w' Q
}+ E" Y# O4 a2 |$ G( q
}
! q; T% G2 W: Y: \
5 |+ N! o5 R& I' \& S" z& ~if (iedom||document.layers){( w  M. W0 @! X) `- r
with (document){
2 ~, Z' T0 o1 d5 Z6 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) f# L0 F: i+ O" ?9 V
if (iedom){
( u/ R4 y1 I- l3 Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 K1 t. w7 V$ ^0 h! s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 }: M* M$ w6 }. @- E; ~* ^7 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ q5 W8 L; D8 m3 C) Ywrite('</div>')
% u4 \" G8 k% d# O. f9 W8 u}
5 K* K5 p: i- delse if (document.layers){: l' t% Y: u6 q2 O- V" F, T2 ~  d  J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& ?8 v; ~- T3 `6 O( b! b: ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ \/ [7 B+ ~  p: @
write('</ilayer>')& s) G6 U6 g) d2 Y. R- k- X* R
}
, X" W$ u; [" F( z9 Mdocument.write('</td></table>')$ B) |7 _: p, x* m, f. b2 c8 A; d
}
" m( f6 ^% n2 K/ g' w* v}. q& I: N; ?4 d& `* q
</script>

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