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

|
网页之跑马灯文字特效
//修改宽度. E- k8 M6 j* v8 r: P- K2 V- U: z
var marqueewidth=3002 ?6 L4 P# Y4 q- G& [
//高度/ J+ T3 M# \' S3 F% w: u/ s
var marqueeheight=25
2 ?1 Z$ J3 D5 \//速度(1-10)$ W+ b9 v/ y) m( x0 B4 k
var marqueespeed=34 Q2 h7 g- X; e& p& w4 E, u( {
//背景颜色
4 \+ o, l2 H) ~: i( qvar marqueebgcolor="#FFFFFF"
) O$ z( Y3 ~9 _7 A//是否能暂停 (0=no. 1=yes)?8 V# e( L1 a3 G7 ~$ e
var pauseit=1
. K0 `9 s: K J6 \
3 N8 @0 U; Z. [. [5 `//修改显示内容% ? q* W1 X! X& {2 _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* ~+ @; [9 G, h! x2 q" }5 {8 a! h
4 y( A4 y5 |$ u+ D5 g: R
! K5 `6 Y& l/ a9 G////下面不需改变////////////
% o4 ]! S" r+ r& U1 N' F2 n# h! b. q
var copyspeed=marqueespeed0 ~8 e# c3 W' l
var pausespeed=(pauseit==0)? copyspeed: 0# G- Q6 E" h% y; A. |
var iedom=document.all||document.getElementById2 E- P2 ]: F! _
if (iedom)
* T) D- l$ ?* p, i5 E% C, Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 `0 D: c! H" {* Mvar actualwidth=''
5 U5 Q) \/ z. Kvar cross_marquee, ns_marquee
# ~9 ^4 M& q. n: y0 x& v" a# s; E# Z( L% n* x6 m9 A- F v+ Q
function populate(){
2 c2 B: g' M% Eif (iedom){
# }6 Y5 P, \$ C( |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" K* m! X2 R( R; |! N+ M. w
cross_marquee.style.left=marqueewidth+8
$ s2 S* _ S7 x2 B* Vcross_marquee.innerHTML=marqueecontent
; y- q7 [7 a: ^" F6 jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" i! E% V& L( S1 i- W' @- w}
- I: |' Y- S8 m/ xelse if (document.layers){( {2 t7 Z4 J- P O; h" a8 T
ns_marquee=document.ns_marquee.document.ns_marquee2
3 j2 U' }+ w& b9 nns_marquee.left=marqueewidth+8
6 H! k% ^3 [6 c0 F8 rns_marquee.document.write(marqueecontent)
, M; C9 B1 _3 G( wns_marquee.document.close()5 W% t' b, z5 z5 @0 d. a9 s
actualwidth=ns_marquee.document.width
9 Q/ s6 l X4 W/ O7 M/ d}# O# d p4 Z1 c o( _; x( d$ X
lefttime=setInterval("scrollmarquee()",20)
/ f/ m; L" j7 H2 X) X$ ? k' r}' v9 O* F6 \# l* j
window.onload=populate0 O! U: t- Q3 R; h: }5 T
2 E( q- w2 Z# Q5 E
function scrollmarquee(){
& _/ j% G5 D- l9 _& l9 ]) Q, R* aif (iedom){" r8 B% K4 K2 J7 Y I5 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); i4 m3 ^; p3 o( M3 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed a! x: ]& l0 Z5 ?! z
else7 Y$ k0 W& G: b. e# U/ `/ h0 K, {
cross_marquee.style.left=marqueewidth+8
# i* h$ `- a1 ]" t5 ^; y8 J% B# n' b `5 O) N# m
}
$ F4 D! ]" G% ~: ?else if (document.layers){
2 o" d h0 q( J6 K- R5 jif (ns_marquee.left>(actualwidth*(-1)+8))
5 C/ u- K2 p" g5 A/ [4 h. g8 F1 T5 wns_marquee.left-=copyspeed
) j( V0 M5 V. h( c! e' B6 Y# _else
) q* l( [! v$ C# X1 u1 A. ?" Y% Pns_marquee.left=marqueewidth+8
+ g- p5 ]. {7 Z- h' ]3 ?) Z4 Q/ D0 K}
5 Q- H. O& a+ h$ \; w |' m( g5 ]. d}
, d1 @+ q5 x$ }3 B- S* Z9 f+ p, _5 _' N7 L
if (iedom||document.layers){
9 t" Z1 H7 r4 ~2 q& D' q4 Kwith (document){
$ B) T5 M; ?: `' i% @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% C4 [( S4 N$ \if (iedom){. I; U v- I6 h w0 Y! J( N1 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 S: k1 t8 u/ ~. Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* w! j3 S8 N X0 G$ E" k# cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); g$ g% d2 e- q6 z: e2 z
write('</div>')+ _+ |1 O$ |& G/ M. L$ O, ?. f
}% P6 c5 T2 c- L4 W$ l$ C( p
else if (document.layers){
! X- U3 S* o r" rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. P6 {/ L& I9 v: f3 w- ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; J/ d* a3 A5 f9 E8 I8 v2 k: mwrite('</ilayer>')
6 I8 G6 @: o% W% V9 V}+ `3 D. O. ~# _* S' f* l6 G; P- X
document.write('</td></table>')
9 L- B' ~1 E4 i2 w# o; w}
: u6 B( d: \0 H: B% ^4 }}5 b* O# h* X1 H/ Z% q1 J$ t
</script> |
|