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

|
网页之跑马灯文字特效
//修改宽度
! A0 v. T* K" h- |: n3 \6 [var marqueewidth=300
& T+ @0 q( i+ j" C8 H, i, O* g//高度6 u1 H6 k4 P( |+ C+ \ `; Z. a
var marqueeheight=25& H+ t+ `0 C- r( y1 ~ w1 {% v: [
//速度(1-10)
4 H5 G$ Q" P: ?1 }, L/ d1 \% Evar marqueespeed=3# Y* ~1 J* @6 K
//背景颜色
$ H8 W6 x g/ Nvar marqueebgcolor="#FFFFFF"
5 z) `, N4 q3 W( ?% x* [5 B//是否能暂停 (0=no. 1=yes)?4 X X7 @/ o! X/ V2 v6 u2 _+ P
var pauseit=1
/ O5 U: L( d2 F+ T x
) ~ `! M% s2 c7 U//修改显示内容
% `7 h, m& ]* j) l# d5 qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) e0 t5 g2 [# g C3 @. O1 ~' P& K: O9 ]/ p. E
7 [+ ]1 }: c: R7 x- l////下面不需改变////////////# u$ W9 _% V* C8 T" M0 \6 y
( p. Y, I' J/ S/ ]! @8 m, ~
var copyspeed=marqueespeed
$ }2 {9 ], @& \5 L( g: ~6 x9 mvar pausespeed=(pauseit==0)? copyspeed: 0) ~$ K; z# W4 w) Z/ _
var iedom=document.all||document.getElementById& N1 K3 T/ \% ]) N5 \
if (iedom)3 B f: _# p# O1 W* N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 E+ U# L: A% \( Ovar actualwidth=''
/ G' z) r, n/ E) `/ k! u2 T3 p7 Qvar cross_marquee, ns_marquee
% s) Y; ]: Y8 y0 @9 t% Q- {, ?
& q6 z0 M! `1 o/ {4 Yfunction populate(){
8 C# L& E9 \/ ?! X1 b Xif (iedom){% K. E( {/ }* y* C- Z( n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ W" I% l' `" F: j2 J
cross_marquee.style.left=marqueewidth+88 ?8 H: ~1 I4 N( @3 {
cross_marquee.innerHTML=marqueecontent
. R$ t3 e; j( H U7 Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 s+ ^3 g3 R# z- b( U4 ~, a
}4 q0 R3 k/ X% s0 L- [
else if (document.layers){
1 w3 o, e* v1 b3 ^ns_marquee=document.ns_marquee.document.ns_marquee29 l9 p" W! ]6 X9 p, C/ T$ V8 ^$ B+ O/ O
ns_marquee.left=marqueewidth+8 `+ C9 C7 N! S
ns_marquee.document.write(marqueecontent)
1 ]& ^, t6 W. t; v4 q+ xns_marquee.document.close()& Q( X7 J% F3 T! [1 P0 a* i$ ]
actualwidth=ns_marquee.document.width
! V1 ?, @! V( @}: G+ d& j+ x% ~3 N
lefttime=setInterval("scrollmarquee()",20)8 f# i( x0 r' d. |, F% W
}
/ ]. }" j7 `) p" z* }4 c' rwindow.onload=populate
* |- P; x6 R( X# U* S7 z; i$ I
% d# d+ w4 q+ Q% D2 Z7 Z( [6 Wfunction scrollmarquee(){
# U, ^+ j% @6 lif (iedom){
$ D* E0 b1 Z7 ^. l Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( U) R& C) {% w% t: I% e2 q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% {5 H$ m- i; ]( Selse1 x# H4 a3 K7 }9 e" o+ y" o
cross_marquee.style.left=marqueewidth+8' S. o4 ^/ \0 O1 W% y4 ?
7 c$ }8 o5 u. W- V8 t7 m6 G}: d% H/ f0 o, N- H/ V% D$ V. E& g
else if (document.layers){1 ~* E# l* w8 }
if (ns_marquee.left>(actualwidth*(-1)+8))7 c* T3 T) V: p6 c1 G
ns_marquee.left-=copyspeed
% w& s: }4 v& q' n4 qelse
) i0 f) N, Q3 v* r6 M% Mns_marquee.left=marqueewidth+8. Q4 D) @6 H6 W. K+ i5 [
}2 J* r& W6 t0 r. k2 k* Z
}
$ |" S7 ]# ^6 K" [0 x
; H6 @" C+ m% H3 xif (iedom||document.layers){
4 t" M5 f* B4 s5 H% i O* Bwith (document){! r4 ~2 v7 t/ n8 k4 I, J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& k, G9 b: P- f x
if (iedom){
, f1 O! X+ b' F0 vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# \$ ~1 [$ n. n' `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! i# u/ r, v# V/ [3 l+ w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% O9 u$ G u2 M+ {. i6 f* s
write('</div>')
$ p) F4 Q, X) q) N* q$ {}
& g! d' B4 N: z( W! u/ w" Jelse if (document.layers){1 A. i& ~2 T% }- D- {- S% S3 i/ p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): A f: N9 x* A/ L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') x% C) [6 Q5 ]" N+ a N4 F @
write('</ilayer>')
! H$ ~1 | h( B* V}4 S9 c# H2 Q z& H: n
document.write('</td></table>')
% t! f6 N0 T! ?, i) t0 q' P x}
" z: _9 A! w& t) B+ f. i}
: |1 `) k4 d9 S</script> |
|