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

|
网页之跑马灯文字特效
//修改宽度- F2 a0 G' P) f: H
var marqueewidth=300- j$ ^2 H) B: |7 ?$ |8 r
//高度# K4 k. T5 Z u: a+ t
var marqueeheight=25
* h$ x9 C4 s" a+ H X//速度(1-10)
7 G7 c3 S. \% T/ |var marqueespeed=3" R( l( Q3 X- r5 a8 ]
//背景颜色% Z& s9 q* Q3 x4 z3 L# l
var marqueebgcolor="#FFFFFF"
3 D4 l5 g* T- O* r: }//是否能暂停 (0=no. 1=yes)?
* c. T b: v/ h0 J2 r6 A0 i3 wvar pauseit=1* n. m, H: I, F3 V" t$ [
; `; P/ P7 ]; _* @: u//修改显示内容$ ~! Y- ]8 T' u' W2 x& B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ D% g2 s9 E) d, K0 D! g
: I7 b8 E- n: A" y5 ~
: U7 o9 m' l- V) p0 j3 e/ Y////下面不需改变////////////
7 d2 G1 e. j3 K0 S- v$ J( x5 \. [3 V* O) O2 ~0 Z- u& D
var copyspeed=marqueespeed0 J$ t0 i: m' R0 a
var pausespeed=(pauseit==0)? copyspeed: 0* E }% p% e/ g+ n$ }
var iedom=document.all||document.getElementById6 x5 l/ O' K: k2 T1 f
if (iedom)9 p* I# X4 h& I* K8 d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& h( s* }3 u. W6 avar actualwidth=''
& ~' N( t5 c+ t4 t* Xvar cross_marquee, ns_marquee
( V6 e* ~& r5 f' `
- h/ \; t4 y" i# Y. gfunction populate(){' k$ a& d- q" x* u5 G0 ~/ r; i- e0 }
if (iedom){
# t" m4 F4 Z+ I" b3 }$ e6 u4 N A9 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- S7 u; E! u3 v4 R3 @cross_marquee.style.left=marqueewidth+8
3 c* T Q5 W3 P2 Jcross_marquee.innerHTML=marqueecontent+ m k% @" W- R6 i9 \( q P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 [# v. c5 s7 h/ \" \$ q1 v
}
/ z1 e1 O" |3 _3 {" \" ielse if (document.layers){
4 O4 v. n5 _1 O! L" h. lns_marquee=document.ns_marquee.document.ns_marquee27 F) \ j3 _& b) S0 n ?
ns_marquee.left=marqueewidth+8
1 m5 h0 t, u( v: s# _ns_marquee.document.write(marqueecontent): w' @0 A+ ~5 z' d
ns_marquee.document.close()
) R6 r! @1 g$ k8 ] f6 T% B7 l. Pactualwidth=ns_marquee.document.width& p+ N& K" s4 I7 M
}
* ?3 q7 J3 ~/ W: Z, slefttime=setInterval("scrollmarquee()",20)
) g2 }! h! x0 i7 V# p, i- d. ?}0 H+ ?2 ~6 w5 Q" |2 d# K
window.onload=populate
[- y& E- T+ j& Q3 p2 B$ C* G6 G0 y( l
function scrollmarquee(){
9 o/ a5 V T; z( Yif (iedom){
. R& L5 g4 y8 c& p6 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) q2 M. R6 u0 f+ r+ M( e" m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 Q7 C, ]& a: ?0 e. F. Q+ M4 Yelse
1 h! l; e: q" Q& G9 ecross_marquee.style.left=marqueewidth+82 |' }, g% N0 D D [5 M
4 F! t' Y% n% ~- z: Q% ?
}
9 C! |7 G F3 L+ eelse if (document.layers){
7 t: C2 V+ @% Iif (ns_marquee.left>(actualwidth*(-1)+8))' S9 S: f9 V1 f! ~3 ~* g8 j
ns_marquee.left-=copyspeed" J" _7 |7 a: ?! z3 z
else, @' w7 T# z" q: ^2 k5 U' x
ns_marquee.left=marqueewidth+8, h- ^- F7 o, A- ~5 Y. l, c
}+ W+ O+ ^, @) a
}; n4 N9 _) \! H+ q7 H0 J8 r" W |0 h
+ j6 L8 \( _2 d7 ^
if (iedom||document.layers){2 V% f9 F. w) |
with (document){
5 h; K* {( M. O4 b3 ?6 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 w9 Z# [9 Z9 b1 |; X qif (iedom){
( E- G/ l/ c/ T# n: c Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): I. {- @3 G, p4 [- e: ~$ E- E$ W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" \- I1 q7 a; l$ O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; B8 |% t# }4 fwrite('</div>')
9 R3 ]1 B- ^, G* @6 e% X4 v D6 l; W# C; Z}( L* v: A" V) V* C/ r2 D
else if (document.layers){% r/ o; y1 i0 D+ s( Y+ {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# k; ^# v+ W' N; B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 R6 K; m2 @5 g, p) |) O% |# Lwrite('</ilayer>')$ R$ b+ z" F* C9 M* K
}
$ s5 }& s2 E' ?document.write('</td></table>')
; Y( d/ F6 M& d3 T2 h}! |. i5 f J8 i% i$ V* |( c; s
}4 \ c8 M) w. C0 K. P) K1 o
</script> |
|