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

|
网页之跑马灯文字特效
//修改宽度2 Z9 k9 p% o) @6 u7 f, E5 f
var marqueewidth=300. I' t( J4 d9 s$ I: d% C
//高度* ~# _+ j& `8 t0 C! j" W
var marqueeheight=257 N# S1 T% E# K1 w
//速度(1-10)! G: M9 k8 m( H) p# u6 V, }, ~
var marqueespeed=3
: _1 F9 Y, k3 Q4 M//背景颜色
+ A" A/ J9 I; a7 Nvar marqueebgcolor="#FFFFFF"4 e8 D, ?: P- |+ ~6 E
//是否能暂停 (0=no. 1=yes)?& \, q& F8 P, H H" L* }1 g# N6 @4 o r
var pauseit=1
: \: b7 d1 h. }
1 t# }; P" g0 X0 b! L//修改显示内容
1 I3 C g. x. d* ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 B U- [- @; n2 f# e6 J
, [( J6 \+ s! i/ r' r% F
5 G) R1 ^" z' y( F! d0 q+ W; W; J////下面不需改变////////////0 n6 ^1 H& I- |, [5 |" \
) q5 w1 w1 K) l- L3 Vvar copyspeed=marqueespeed
0 |+ K2 o l( ]& zvar pausespeed=(pauseit==0)? copyspeed: 0$ D$ s2 [& t4 E( e8 j( N; u
var iedom=document.all||document.getElementById3 p1 [! \1 p+ s$ I, z# T0 A* A
if (iedom)
; Y6 g# P5 U& \& ^' Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) @0 J0 T# E9 d( q2 L% Svar actualwidth=''- z ^& Z% W7 h8 \- s3 h
var cross_marquee, ns_marquee
- t- Y7 P! d) s' q( [" [
3 i0 `1 D. i* r" S# q* g! s7 H/ Efunction populate(){* G8 Z& w4 X: o, G' {; i8 ?
if (iedom){: J* }% |! C, y9 j6 Z& V0 G; n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 Q D; }, D- j" x6 P! A$ [5 W
cross_marquee.style.left=marqueewidth+8) I# D; f4 h `* ?3 M% \
cross_marquee.innerHTML=marqueecontent
/ L8 L. h* ]8 o6 X8 O% r7 ]7 @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: M3 i7 v; P# D; w' c
}; N8 `7 j+ B2 s2 Z) ]/ V
else if (document.layers){
/ _. {$ m/ i* X& N9 C/ J0 L! yns_marquee=document.ns_marquee.document.ns_marquee23 z) H' a: v! g
ns_marquee.left=marqueewidth+88 ]- A) j* M$ V& V$ M0 M2 n
ns_marquee.document.write(marqueecontent)! m$ a$ H: J; k1 Y3 d! ]% {9 M5 C+ s
ns_marquee.document.close()% q2 M( c, n8 c4 W2 L" L8 Y
actualwidth=ns_marquee.document.width6 U2 B7 H; J- R* O
}
( y( ?8 T" Q# B: V) b$ h$ G: Qlefttime=setInterval("scrollmarquee()",20)5 r7 }/ t# J' M2 F" k
}/ G- F2 m5 E/ m
window.onload=populate) B. v! d( Z& r4 d# Z) p; T- B8 m% k
$ }; i. y) U% e; k" @4 i5 @# @
function scrollmarquee(){' M. F# e. C2 |* r* t1 Q+ m6 I
if (iedom){1 |( `' |; R1 ^! a# s( z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 i2 Y# O, }5 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ ~$ P; I0 t+ melse$ G5 |" Q! f+ p
cross_marquee.style.left=marqueewidth+8
/ w$ U' a" g# l, c% U
6 k; ?7 V6 P$ f! G9 R5 S}
" f N3 W' s& ~2 Q5 }else if (document.layers){
$ l$ s1 a. R! G6 N% Pif (ns_marquee.left>(actualwidth*(-1)+8))
& u( `+ N2 s. w& L9 E& F8 {ns_marquee.left-=copyspeed
8 a9 R; y8 k+ S/ B) a5 L+ Relse; S2 f. L( c7 t
ns_marquee.left=marqueewidth+8
9 s. ~" y$ T( u. F}% l( t' s$ r6 v8 E C
}
0 M$ L2 Q- o3 s5 o
( D( f7 r! P4 S9 A. E- M) G3 H6 Xif (iedom||document.layers){9 M7 r2 y3 v0 [3 |) Y
with (document){
- S$ f& r+ ^ |0 A W# v) h5 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ J6 x0 t3 D: _6 P8 @if (iedom){
k' Z, E" L" d. N+ rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 P( c- k0 p7 w; ?, ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) K3 M) G* l# e6 h, {# g# L, \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% ~' k8 u0 S l( `2 D7 x( b: Qwrite('</div>')
% z1 r: ]3 r6 e}- f9 l& D( T1 [- D
else if (document.layers){; @6 G2 n5 H7 j! ]. T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ {: K5 t6 z) G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: [; E9 E7 o5 T5 h2 a, |write('</ilayer>')8 ^$ r8 u9 h" l% N) F0 q
}5 j& Z, k6 s( m
document.write('</td></table>')5 C) U. O0 r9 }* A$ w
}. u D% ^" Q3 w4 |
}- X0 ?5 p0 k/ S7 c
</script> |
|