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

|
网页之跑马灯文字特效
//修改宽度
1 ?% ]8 a0 \6 rvar marqueewidth=300
6 h e$ a8 H8 v2 t2 @% _8 y//高度
8 q; c. R5 S5 |/ {var marqueeheight=25
. a7 j; z p1 ~" @1 R//速度(1-10)
8 I) y% ?7 ~- ~2 a pvar marqueespeed=3 _ X! }& g. e3 ~
//背景颜色
7 x1 j+ o: A/ J5 W$ Svar marqueebgcolor="#FFFFFF"* V" P: j3 ~% ?" B
//是否能暂停 (0=no. 1=yes)?
* e( q8 E. E: S8 T tvar pauseit=1
( z$ _: I4 f1 A" x; B: v6 O
# v' e t6 C' Y0 P; G//修改显示内容
; m) g6 Y7 |9 R/ s( O0 `& Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# u$ g& M! B1 d& y \* T, ?
' U/ b8 d& ^# A6 h2 m! ~
; K+ c- H0 v' @2 _: ~8 H////下面不需改变////////////0 F+ [7 K4 }/ U! Z
, Q- K7 j7 ?8 @ t) E8 [' Avar copyspeed=marqueespeed* W* h+ V) o, {* q5 J# `! l3 m }2 m
var pausespeed=(pauseit==0)? copyspeed: 0# r0 d8 b& O' Z) p4 h
var iedom=document.all||document.getElementById
4 t, Q+ G1 j+ P+ f5 Xif (iedom)9 U1 M: \7 S' r! }" t/ i3 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), Q0 f4 b! S; e) T+ x
var actualwidth=''
1 j# r d( m- Vvar cross_marquee, ns_marquee
$ _; m3 e3 O, A& Q" Y/ C8 \. x r1 _" C3 r9 B% a) R# L$ x% k |
function populate(){ M/ I- e$ |) r
if (iedom){! P3 ?: i v/ E" ^9 c! S# h0 f/ V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 u( w$ z) s7 j3 a# v6 g
cross_marquee.style.left=marqueewidth+8
7 o$ d' u, ^+ I/ p$ g Hcross_marquee.innerHTML=marqueecontent9 ]) O/ s7 i+ O |1 E6 z J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# y. j1 o) A+ H, m
}
1 z6 z. }: _" z' h* p, c) zelse if (document.layers){! Q* |: C) {1 N8 G' I
ns_marquee=document.ns_marquee.document.ns_marquee2
J W& j7 u5 J0 T$ xns_marquee.left=marqueewidth+8
( l; w' m. \" s& z8 Wns_marquee.document.write(marqueecontent)+ u2 M! E! M r8 H+ t8 x
ns_marquee.document.close()
! D1 S% u4 i7 l" U; Kactualwidth=ns_marquee.document.width
! z+ H% V# r4 b- _8 ~' X* ?}
: V5 H+ X- N+ V$ P5 W+ Ulefttime=setInterval("scrollmarquee()",20)) ^7 m/ J% b' @
}* j2 k6 z" k* d* p3 E0 t
window.onload=populate& c6 k. F9 G% f% L) {7 h8 ]
A j# l }1 L5 o% c3 ofunction scrollmarquee(){
1 T8 j* Y j5 T' ?( q5 Dif (iedom){
6 O, X+ i1 C' C+ x, F( }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, d0 O g2 r0 ~7 P6 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# y Z4 L; K1 B/ W0 n& w: D
else
: O( m$ N1 M& L8 Z) O9 u- i2 u8 Across_marquee.style.left=marqueewidth+8! j6 ^7 k: s8 X$ C: Z. i& A% e$ E
& P5 `0 `4 k* `
}
9 K, I2 w( e2 {! V$ Kelse if (document.layers){
9 Y. j: x2 i S) K9 \if (ns_marquee.left>(actualwidth*(-1)+8))
+ S( i: r4 A% t6 v0 `/ W' Fns_marquee.left-=copyspeed
+ i. c7 Q8 _4 f8 r q1 L0 m; Y8 y8 I- ~! Velse
' V9 P; Z5 R" M+ @* m+ ?% mns_marquee.left=marqueewidth+83 X- G5 \: e3 s, B
}
7 m _; k6 w! i+ M* c}
* @2 x' m6 V8 S
* ?4 _$ ]; E5 a, O( \. }if (iedom||document.layers){
3 b! b& z: K6 S( y; B" awith (document){: k$ k/ r2 [% o' D* @! m! o7 b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! }& N' S# {4 E. H D$ p0 E
if (iedom){ G- c* ` S8 J: k3 N g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ C2 t8 d1 q( O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ J$ m: h7 C) [3 o2 K2 ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 z/ c" Y$ D# O* X
write('</div>')
3 p' m! B1 |1 ?# A}/ }0 o; E8 _) b. J! ?) L& v
else if (document.layers){, Q4 n! D- r0 _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') n8 J) ?" a M; s! r+ i4 [0 N; H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 j& F' b* S: m
write('</ilayer>')
% K$ T2 l" j$ P9 r/ o}
$ }* @( r% p* N( ndocument.write('</td></table>')6 {; a6 I2 z. }) i) C p$ X9 T; a
}# ], h9 t( b i+ S
}
. ?/ o. Q8 h/ n</script> |
|