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

|
网页之跑马灯文字特效
//修改宽度
7 p3 A2 B* g6 m9 ^$ j& a7 ]var marqueewidth=300
2 Z3 J0 N+ ~1 b( _1 R8 i$ e//高度' r. s: G% j$ K4 r, X
var marqueeheight=25
; y4 b n; r4 A. ?7 S' T5 U. i2 X. z//速度(1-10)" K7 x1 P/ t0 U
var marqueespeed=31 ^+ I* G6 k; L& M, t- s' I
//背景颜色
. w! L6 s G, E8 W0 G; rvar marqueebgcolor="#FFFFFF"
' q8 _" A% l1 b \7 ~% Y, e//是否能暂停 (0=no. 1=yes)?
4 n: p e4 S! C( Yvar pauseit=1
7 `- D& t" j* B& C! {+ K: E9 P# d- t1 m& j
//修改显示内容
% J/ N: s( z7 p- e0 a( g/ d0 Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* K" g/ L* N" R& w8 J
+ \& @7 E2 ^' S4 a! [6 H
b5 |/ V8 m3 v! h& \" P% ~$ \////下面不需改变////////////
7 o: W+ c4 P& ?+ @! D3 P- h( C
$ T R' Z/ V8 n$ Mvar copyspeed=marqueespeed
: b5 i( ]$ }, j2 r6 y/ }+ c6 rvar pausespeed=(pauseit==0)? copyspeed: 02 \1 K+ F" _# r. N5 V# A& V
var iedom=document.all||document.getElementById |1 _0 \: @+ H4 k6 C6 M" B( F |
if (iedom)
7 s# S% O+ L; ?4 @( U. R3 X4 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 B! H6 C2 F# c Vvar actualwidth=''. _( l" b% |( U+ V; l
var cross_marquee, ns_marquee; a9 M+ t7 V' D$ r. O
1 I+ k! @* d; J$ U5 F$ w6 O7 c6 Nfunction populate(){
2 v& v$ Y3 v& h/ Y) i: jif (iedom){
' H9 a8 }/ }7 Z( Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ A4 b( H7 Z( D& ^- q# n- X: m' N
cross_marquee.style.left=marqueewidth+87 q) d8 {1 J$ B5 z
cross_marquee.innerHTML=marqueecontent
) i; v7 H+ e! H+ P0 ]+ Y) Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" p% @2 |' ^% O
}
8 \$ K1 O! B0 t4 h u1 xelse if (document.layers){
8 J# G: @" D- t5 D/ Ens_marquee=document.ns_marquee.document.ns_marquee25 i X8 Z# O: U5 i% `* `
ns_marquee.left=marqueewidth+81 `" z) d3 j9 i) V4 R6 ?
ns_marquee.document.write(marqueecontent), L! D; \# }, D
ns_marquee.document.close()
. _# |4 V: o2 X c. h9 O5 O6 hactualwidth=ns_marquee.document.width
8 ]/ e z: P4 Q; i9 m" W2 Q}
& ]8 }# L R6 V% m) a# m' vlefttime=setInterval("scrollmarquee()",20)/ a- G; t6 W' m
}% d+ Z) u; H k/ u' \7 w( o
window.onload=populate9 F% A y5 ?+ ]5 @
$ G. s( ?, Y* T- g; a
function scrollmarquee(){
* X0 K; j. L) D7 A8 B" f! Mif (iedom){
9 m( P7 i5 k6 _ K5 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 e2 b7 \3 B/ K" P/ c ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" T6 O' l/ Y1 X8 o( \else
: X5 p, f/ n5 v# _: i9 ?: X' Pcross_marquee.style.left=marqueewidth+8- V+ c" ^9 i- b4 }+ r
% d$ i- ^ i! B% c0 K5 I}/ C @% V8 [. \$ X+ T6 @
else if (document.layers){3 s% h0 m' Y2 l# c/ ?
if (ns_marquee.left>(actualwidth*(-1)+8))
, M3 G- r6 p. M( P, {ns_marquee.left-=copyspeed3 v% h3 D# s0 } ]
else5 B% f6 S9 q" F% ]1 m w$ H
ns_marquee.left=marqueewidth+8
" h0 N- {+ S; ~2 p* }- r}
! U% @# Q# V+ g}. J4 _4 p7 n I, N9 r, G
; l1 o* u: u9 v
if (iedom||document.layers){0 O/ C2 p6 ~ L
with (document){) z$ q w& s' [- g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ @3 x+ L6 I5 p8 `4 i
if (iedom){
- j+ o5 q0 U* O! W0 ^6 w9 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ C( i: F& R% ^& }' w2 h. [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 c. W1 D1 V1 v5 s+ z2 {+ iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% h* _& L2 P( G6 s& i; t, R
write('</div>')
" R( u9 @1 k. A! d% e4 y}! A0 @8 W3 _* ]
else if (document.layers){
7 a! U" Z* L' L# a6 r/ Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 D! {2 Z7 e5 U0 T, D! H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 \ p0 X" Z& q3 O( Rwrite('</ilayer>')$ S ^; d- G! m: f/ x$ ]- l
}) Z6 M+ `+ N1 V3 G- O6 y1 S9 I
document.write('</td></table>')' E: a2 O! ^8 e0 X
}
* [+ [6 C. X* n; M7 E& W2 v}
" j+ K4 K9 o0 Z! J</script> |
|