返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 T+ ]* i) e& s; y( n
var marqueewidth=300
9 _1 ^/ i2 z! N% N6 _4 F//高度
! p0 f. \" a2 [4 B# G; tvar marqueeheight=250 [& J/ X% o. A  Q
//速度(1-10)# s6 r' @+ ^. \7 C
var marqueespeed=3
" P3 `9 p" }& A, y& e! H) [3 j//背景颜色
1 j2 [1 g6 Y) W( E* S7 S3 K! mvar marqueebgcolor="#FFFFFF"
% p8 J, X- A+ R+ ]6 I: g//是否能暂停 (0=no. 1=yes)?
* H0 ?( `! x1 `7 s3 z" Ivar pauseit=1
9 m4 v  n+ \5 b; a7 ~: n0 L6 Q
* A, x/ N: `6 b2 a, A% }, o& Z7 [0 S//修改显示内容
- C1 Y, Q7 S( Y7 [; @2 b- J1 t1 g+ ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 b. c$ J7 n1 k$ `$ l) I* i$ `1 m- n% u4 x

5 L  B2 n1 a# K* X3 S- U# {////下面不需改变////////////' A! g! _: U5 Y) N: ?
! y( `& R( e, g: m+ G8 s; D7 q& I# }
var copyspeed=marqueespeed- o- W, m! n/ q
var pausespeed=(pauseit==0)? copyspeed: 0
1 e0 l( f" y0 W2 R2 e* \& X1 rvar iedom=document.all||document.getElementById
! w2 O: Y. X5 i  T0 ]2 K" B) K9 gif (iedom)
$ P3 v, _0 F* A2 P, hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Q; |8 f/ F* q) F* d; Mvar actualwidth=''2 O3 |" F6 o! d) |& k
var cross_marquee, ns_marquee
/ v; m0 K+ a/ \# j& A4 C  S: r) C' @! `. e! @% E, X/ r
function populate(){
# P  z& y5 |4 A5 Uif (iedom){
* B+ e2 D3 c: m4 m+ O, N5 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; K, ?. P, g1 p: R) V4 Q& W8 n: ncross_marquee.style.left=marqueewidth+8
0 |: z' J- R# \3 D$ H6 y6 Ecross_marquee.innerHTML=marqueecontent) J; y" Z  V3 [: k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 ^7 ^) F4 }7 d+ Y5 S6 H$ T
}
4 q; H  d% i* v# T; b' @4 Pelse if (document.layers){" ]! l  ~' ^! N5 [! e' M
ns_marquee=document.ns_marquee.document.ns_marquee2
( H; f  I4 o5 ^ns_marquee.left=marqueewidth+8  |5 Q9 M- }( ?% S+ _
ns_marquee.document.write(marqueecontent)
/ k0 n& L; Q8 `& }: g5 R4 N' i# \ns_marquee.document.close()
, H1 x, [" N: G* L1 V" Vactualwidth=ns_marquee.document.width
" S# F" n4 F: N7 @$ F, }! p1 Z}% R8 I* |7 n" M8 C
lefttime=setInterval("scrollmarquee()",20)
4 q1 o- J+ v# E5 }+ K/ T}
- }' p  Y" O! g+ D5 ~window.onload=populate
2 |1 W, P; Z, _+ R8 M8 i& n3 c, p' I9 `' V& v; o
function scrollmarquee(){/ q' ^% p6 H" s, ]
if (iedom){
* B! ?  a. M! j+ S- z1 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' `1 e7 Z& f' M$ G: Q2 Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ _9 U' w- E$ T8 O. h1 L0 |
else
3 n# [; a) K7 V" [cross_marquee.style.left=marqueewidth+8
: x7 ~: \8 W4 L. I& N4 F3 U
) v- @2 o  }, U6 E6 Y- u}/ Y4 P6 E+ }3 u& ], C
else if (document.layers){
# c- C, c" D9 y# r/ @; eif (ns_marquee.left>(actualwidth*(-1)+8))1 d( j' N( [% d
ns_marquee.left-=copyspeed
' f- W) s8 ]" Q$ b6 j* Helse
, S5 ]5 {: Y; C  d: n; ]* qns_marquee.left=marqueewidth+8$ d5 R8 p) r8 {( z- x8 a
}
1 [9 R; t& x2 R}
/ j' v9 C& ^# F0 v7 O! u  |
& b9 Q' x% s0 ^) d$ f* t5 Gif (iedom||document.layers){3 p( r/ g- l, ^: B
with (document){  B5 @$ p! r0 Q( v8 j# x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" O. ]: ~0 g' w; b! n  X7 `
if (iedom){
# o- Z" I8 K: @4 M6 Q2 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' c) |9 p& K1 y5 E) z3 g3 u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" q1 s; _' z$ h5 m$ Q5 |; k" mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 u- o9 f4 m# c9 l' e8 C/ f/ C% y
write('</div>')* P- K) X1 i! g( O' k5 B
}
. d* F7 I! e* q9 d! C" n& b7 G3 [else if (document.layers){1 u. J% h5 C3 w3 u1 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 O1 p% s% P7 Z1 C2 Z) f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 U7 i5 S  S  C  {; e$ s/ Y
write('</ilayer>')
) x, u, b6 Y$ d}( s" b8 K  K- @! J
document.write('</td></table>')
* t1 T1 f; O+ u4 f! L}! G1 B6 Q# ~7 X9 G: `( ]
}) k, C2 f7 A$ S1 p
</script>

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