获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 |7 ^% P% e( o9 e5 L
var marqueewidth=300
; Q2 D# f: R, L  t. }//高度/ c2 W; q7 S. ~  j
var marqueeheight=25
3 H3 s' K/ I* ?+ a* z' Z3 `: i$ N* ~//速度(1-10)
+ l. h1 A+ }- {! pvar marqueespeed=3* [  [7 a2 M3 B
//背景颜色- _9 e1 ^# P/ X9 S# l
var marqueebgcolor="#FFFFFF"$ t3 [1 x1 t0 g" f. N% O9 H
//是否能暂停 (0=no. 1=yes)?3 ]$ p! `; ]' d" R2 p0 n# {3 m  q
var pauseit=1# ^  ~7 r$ j3 h" T' r
3 d7 f+ w. W! ?! V# T. g
//修改显示内容7 U7 I( J! L" ~- \9 q4 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" w7 G0 x2 a. U$ k! M+ H, V% \0 d
2 _( }' F; ^  {: N' O/ G3 q
* s- n1 S" X4 J8 m9 N+ j) v% p
////下面不需改变////////////) `" F  G( \+ m8 H% S
, S# S8 o2 L( |0 ^
var copyspeed=marqueespeed/ M" M9 ?* k/ K* o6 z
var pausespeed=(pauseit==0)? copyspeed: 0
9 n6 r3 Q* r5 m9 C+ Z: jvar iedom=document.all||document.getElementById
0 [" x; j3 A2 t. n# {- dif (iedom)9 m6 |4 t0 X: h: ^7 [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 c' J7 R0 k8 u7 Y* v2 |3 \& Avar actualwidth=''8 M) k. |- D9 {6 f9 h3 D
var cross_marquee, ns_marquee2 I+ O! @* P! A) S# F* O
; X% q; [$ a8 F& R7 J0 v: a
function populate(){
+ _6 l7 S+ {  C8 t6 Q: aif (iedom){
; H. u2 O7 |& k0 t& \7 t0 F, u% w. Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 b' }5 ~" n& d* ~) Ncross_marquee.style.left=marqueewidth+87 Z/ E" g$ ^; Q! g
cross_marquee.innerHTML=marqueecontent$ a: M! K4 @2 @! u* P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" v3 o2 s: T2 I  ]0 R
}
% v" i' \8 a/ J2 C: }5 Melse if (document.layers){
$ I) N3 G# ^$ r* g  n. fns_marquee=document.ns_marquee.document.ns_marquee21 ^' {. A  F; x. v$ x# t$ Q8 j8 B
ns_marquee.left=marqueewidth+8" c- M3 `) {$ l+ s
ns_marquee.document.write(marqueecontent). t2 ]; Z! d9 Y3 S: s) z- i6 E6 C
ns_marquee.document.close()
+ `8 |) o) t. V% S- cactualwidth=ns_marquee.document.width* _2 K4 ^9 s4 A! q7 \8 b
}" v, ?; K! Z8 Y" ]/ y1 V
lefttime=setInterval("scrollmarquee()",20)  X; c3 h9 _6 q( V& |- M: A& E
}
: j( ^% v5 `; ~7 {  ~: @# Vwindow.onload=populate$ G& W' `7 J4 f% ]. i
6 m; M5 [+ y+ H/ o: |# e
function scrollmarquee(){
! D* P+ ^, e2 [: \$ bif (iedom){$ Q( P5 t3 z% z8 j$ X4 V8 p- p" @# j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 P0 l8 u9 _$ h$ [! U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" Z' Z1 F0 S( y+ P' T+ E3 c& H, X2 u
else6 M4 |/ e4 z9 L; u' [
cross_marquee.style.left=marqueewidth+8
) [$ b- w) I: G+ a0 Z* [. |* O  j
9 i9 p- Q2 J. ~% ?- ]8 e$ y4 p; [}
# ]7 [; X  {& Selse if (document.layers){8 O  F9 ?# c- y  `
if (ns_marquee.left>(actualwidth*(-1)+8))$ N% ~3 J) I& W6 E  j" p! s) o: x
ns_marquee.left-=copyspeed  ^" O, F& h4 X2 n& Q4 n% z
else$ G  z: v5 o- \. N. r  s/ v+ X3 E+ N
ns_marquee.left=marqueewidth+8
* G* J+ x- p* W* f+ d  C& D% W}
, S* N9 m2 c; m0 G}
# D3 u8 I4 I0 H' H% [. H( Y' f) U* e% K+ \& ^3 L, I( _! X
if (iedom||document.layers){7 `* Z# V: N* B5 i
with (document){. m/ s$ J: i% @4 Y2 |2 v) t  v! {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& u. n9 y/ m- z5 z# qif (iedom){; j+ @1 R. x, x, q7 l9 i) j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" y7 K. p' j  L; H) q1 [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, j% A3 b; U# B; i! Q$ t, nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) r) D) K$ d% @: Z; k) M$ l
write('</div>')3 l, Z# u) G* J( F
}
1 u0 R* b5 y1 B$ ?; Jelse if (document.layers){+ l" ?6 Q& [, L, `3 h! Z- Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* B( b% W7 w9 I. L1 c- c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 F. `8 ]. g/ Q3 h4 P( Dwrite('</ilayer>'): e  I! K- ]$ M0 ~! r% f7 Y
}
$ X* {# I. K4 T$ @document.write('</td></table>')
& Y' |0 ^8 Z1 D& B/ _' A/ f* Y6 i1 P}9 u5 w  n% U0 P& K& y
}* r6 \7 m0 X# E; d7 s( l! K
</script>

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