|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度) ^ t' a7 V1 \( Z
var marqueewidth=3006 }. L: j, ^9 Z4 v. T# r
//高度
! o3 U* X, @4 {1 `! B5 Tvar marqueeheight=25% l+ ^3 y# D8 n1 G1 O) I
//速度(1-10)
% |5 u5 z: @8 ]1 Vvar marqueespeed=3. g6 Z( K$ y# H9 `; u2 L
//背景颜色
# q9 {1 B$ j' i8 e8 s4 C9 H# x% Ovar marqueebgcolor="#FFFFFF". t4 f/ O1 f3 Q! G3 k/ l
//是否能暂停 (0=no. 1=yes)?/ i* d% I( Y8 u8 i4 |+ n
var pauseit=1
: B b/ k( ]4 j& z7 O" V- O4 j, ^9 w. h
/ T+ t7 R. Q( s//修改显示内容" `% T7 f. [ s7 w+ `6 O1 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; g1 ~/ _0 o& ~9 d; O9 Z
: V/ q6 B; g1 J# Y3 X- M
! U1 i2 z( @7 |2 H# l////下面不需改变////////////% k9 o) Y d% ~4 S2 p$ c; _
" ?4 q: Q8 j" r. G5 L8 ?2 C
var copyspeed=marqueespeed
7 Q* g2 L# g" e, P& f0 G) d! O6 @var pausespeed=(pauseit==0)? copyspeed: 0
0 A' z; k# p) Rvar iedom=document.all||document.getElementById
3 w# `2 v2 G# l4 P. v( U! Xif (iedom)
0 O/ S M% o8 _# L/ P8 Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 u5 ]% M! i! P% k( M# l1 x1 i4 Avar actualwidth=''
! x0 p8 h) M) Z' g. y9 Xvar cross_marquee, ns_marquee
- i, i1 [- n6 @) a! {6 f6 b3 D, c% z, c( ^
function populate(){
: J4 G# P5 p, u# \3 `/ Bif (iedom){
9 c4 [9 \" w8 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* ]2 d* p, ^% M4 P) Scross_marquee.style.left=marqueewidth+89 }* O6 l# b0 i. Z' i1 o0 }
cross_marquee.innerHTML=marqueecontent
9 f8 N/ ]1 [' `& l* P: }: W7 e: pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 u* X% I- `: V2 D1 {( J0 Z0 Z
}
5 R l6 Z9 M+ x+ P' \0 uelse if (document.layers){
8 K3 Q% g% q" b8 p! j$ ins_marquee=document.ns_marquee.document.ns_marquee2- C r! d Q' P: ~4 M3 K, P* \. p
ns_marquee.left=marqueewidth+8
9 g% a- `+ v( [" t" c9 Uns_marquee.document.write(marqueecontent)
" L0 ]( g3 m9 l3 p3 ans_marquee.document.close()9 B) Q* J* A0 G0 Q
actualwidth=ns_marquee.document.width( \6 o; N5 G5 ?8 f1 o/ k( c
}$ ]3 U' ?5 v5 l. \) c
lefttime=setInterval("scrollmarquee()",20)
- e! @& ~" q- j2 S}9 \. l4 S& x0 ]4 t1 a
window.onload=populate( e2 ~( |" o* ~
1 _( O& |7 f$ R) I5 s
function scrollmarquee(){- a( }: y( G5 d
if (iedom){0 ~2 h3 F: m) z, { s# q- y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: \0 F0 @- H" L/ r; k+ ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ j e. m% Z( g
else/ U3 _6 ?0 t: A5 R4 l' ~
cross_marquee.style.left=marqueewidth+8
. [1 c" S ?3 }+ l6 ^& S/ x9 X r6 t, M, k9 i# P
}
( T0 I! d+ c) u" _* Nelse if (document.layers){% C n& ? F8 U2 i' p& @0 f
if (ns_marquee.left>(actualwidth*(-1)+8))# y& L' ^$ X/ `$ f$ y! a" m
ns_marquee.left-=copyspeed$ p7 i5 d. F" _; f5 `$ m$ O+ [8 `
else
, {1 B1 Q' Q6 q# f! V, `ns_marquee.left=marqueewidth+8! e7 n% g) E6 @5 p
}
" x/ F- x- H) A1 ]6 V}
9 T% O9 Z' e# T! X ]. v+ H
* f0 `& l0 g- F2 _if (iedom||document.layers){% @4 B& V$ B1 Q0 n
with (document){
0 H# {: b3 W0 V" s/ h1 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* a6 {( b: p; ]$ L, s
if (iedom){& x8 r0 L9 `# q" {' }( ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. v C. J- S4 d8 K$ {, Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 F, [8 c: x( H ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( g# \5 L/ l! j% F; h# @
write('</div>')
3 ^9 M v+ ?, R+ F}! R8 |' T! l0 r, O+ U
else if (document.layers){- C- @9 H: e& \: x* G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' ~8 j: g5 T( S a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& B% p; U+ W5 |. K9 F$ B) w( awrite('</ilayer>') @. L4 W3 `5 W6 `2 M% m
}& p0 w5 H ?" Y9 x# l
document.write('</td></table>')
, m1 j+ {* \9 i}
& O; K$ H* t% h* c6 p$ Q( J( a. n}
, s" V! {2 R7 u$ H7 x; d0 S</script> |
|