返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& N+ p* k3 [8 _. s4 _1 q2 Evar marqueewidth=300
% h& d- X+ f4 m  ]' l! t//高度
: N7 g& I- L( [% K9 b0 Q# T# v, `2 t3 Mvar marqueeheight=254 H5 V: x" L0 }+ Z: k' {
//速度(1-10)
) h% ?; ^* H& {: a( j. o9 avar marqueespeed=3
! u/ ]5 d- e1 R' X//背景颜色' p! J9 }) ?1 m9 U$ p' X& }9 N
var marqueebgcolor="#FFFFFF") I( Q2 \6 e. j  b
//是否能暂停 (0=no. 1=yes)?
- U- B  g) [. L5 {, zvar pauseit=1
- J1 X2 ?3 ?+ }4 ^. K" V+ f
! T% h' r5 G- ~0 ~* L# f+ g# w! N//修改显示内容, q& h/ \9 h1 m# _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, z( G0 Y9 `  ~& T) u* J: F$ [( w2 W) V3 Q6 R5 z

/ C7 s, c2 I) S2 {; h. ^' z////下面不需改变////////////% N! _! W& D+ O7 a7 E

4 M  j6 }$ ]) {9 v% h6 gvar copyspeed=marqueespeed* q' j3 g; C, e& k6 N* ?$ k- Q
var pausespeed=(pauseit==0)? copyspeed: 0
+ f9 f0 V3 R1 s" }& dvar iedom=document.all||document.getElementById
3 k! s7 G8 Q4 g. bif (iedom)& w# F4 i3 H5 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ y+ }) D6 M/ D. F1 w
var actualwidth=''3 ^+ N* |+ G  i1 Y: L
var cross_marquee, ns_marquee+ X5 D$ A5 k! Z. x/ G' U, T6 z
, z: |! W$ n: j8 e" ?
function populate(){% Y& u& A& a" ?3 j$ i8 t3 x( I$ G
if (iedom){
; N) f$ T- n  _' n; C8 H6 Y( _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* D1 s5 _3 o. B0 f! N
cross_marquee.style.left=marqueewidth+8* K) t! a) Q( \$ g4 Y, [
cross_marquee.innerHTML=marqueecontent
0 [2 w, v! C+ G0 [% Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* j; \& V3 s% B
}9 f8 m8 b/ Q2 z/ M. R8 u1 I
else if (document.layers){
8 o- Q) M/ W+ c( Bns_marquee=document.ns_marquee.document.ns_marquee2
' x! h$ u  N7 g! x- A0 `ns_marquee.left=marqueewidth+8; {1 F( T/ n9 I1 |
ns_marquee.document.write(marqueecontent)2 ?1 o3 Q2 F# I+ d% R1 o; ~
ns_marquee.document.close()
/ w9 T1 r* c7 w$ `: A/ t7 Bactualwidth=ns_marquee.document.width& F' h2 r- I* \$ J
}) u+ }8 j- F: B/ f. U/ r( ?
lefttime=setInterval("scrollmarquee()",20)
+ R% P# j- G9 N& ]# B}0 K+ p& a' K! i/ _) p, ]6 T
window.onload=populate% W/ j. k' q4 `+ M- x7 M

6 S  V( Q/ I- R1 x; F6 xfunction scrollmarquee(){' _6 }3 w: o0 W- G; c+ D% x2 R
if (iedom){8 u& {# F: u# a' w# N) P' ?( O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% g. J5 N' a+ W2 {) F# Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 d6 ]. p, t8 G% R, I$ ~+ Q. eelse% r+ n/ V% z' b! D9 Q& t
cross_marquee.style.left=marqueewidth+8- [: m" C  @: W: X) y: o" F2 P& ]

9 W4 H* c# V+ f}3 a! ]% V( T* R' H1 b
else if (document.layers){
$ \. J1 M5 m& p8 R( _if (ns_marquee.left>(actualwidth*(-1)+8))0 k5 M( b8 T& j
ns_marquee.left-=copyspeed
5 P0 S' Y+ M' b/ ]: e# ielse% T6 D- n; }5 M) G
ns_marquee.left=marqueewidth+8
. P$ Q; k( B. M5 v  ?6 f6 ]6 U}  Q" l( b2 W. d
}
* e6 l6 `% G' T" ]1 x0 Z, T, |& S* S' q* n& I/ J
if (iedom||document.layers){0 a6 ]5 A: k; ]. O7 S3 k- E* ^
with (document){
& I- D- F8 [6 v- [1 B! Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 s) a! V* a' W/ F
if (iedom){
* y% J# |' }$ m' @) S  p, {/ kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ n* }! z$ q1 V+ Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 S! L0 D  L  d6 U, o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ i. e8 P( ]/ V4 J7 ?  j! [6 [6 c
write('</div>')
/ l4 m* L. h/ Y8 r) u1 U! J2 b}
9 O: x9 G3 E4 c" uelse if (document.layers){
- y- i/ `# \5 m/ w  @1 _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 A  v5 e  B+ Z, Q, iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% g2 Q8 ]6 N: y# {0 twrite('</ilayer>'). Z. Z2 ]. N4 V- T" V7 J" K0 f
}
3 P# c( w7 E: I4 u/ V- Ndocument.write('</td></table>')
( P; M: u. b* z" T1 z# P}3 A4 U/ _3 R/ ?; P5 Y6 ]5 _
}( S+ q: E2 e& I4 d2 n- F
</script>

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