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

|
网页之跑马灯文字特效
//修改宽度, _ N1 r8 m. L+ i/ ]2 X
var marqueewidth=300
l9 }5 T1 D8 P: _) d3 S//高度
$ R1 q% d1 I: yvar marqueeheight=25
% G; y8 y k/ {7 |) w& }; ~/ q//速度(1-10)
r ^6 \3 x, m% Fvar marqueespeed=3
) d+ d5 B- `3 s' L- W& o: J//背景颜色
% L) s" q; ?, p' W3 Lvar marqueebgcolor="#FFFFFF"6 s3 u3 A0 n! g2 u8 @5 |9 e
//是否能暂停 (0=no. 1=yes)?
3 Q3 P# D- i7 v$ o" b/ hvar pauseit=1
( b T; Q: G4 `& N6 T7 I' q( x* G& m* @/ X' j. M- H" p3 A1 T
//修改显示内容/ B8 u: C6 w) G, b9 A0 P6 y2 N* D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* A% p: Z& E1 U* K
& }+ s y; @# x
! J) w- f8 |& p////下面不需改变//////////// y* n$ P) D' }0 S
% @- o' J, Y" A- _& j8 A
var copyspeed=marqueespeed5 G, B1 g' K0 H8 Z
var pausespeed=(pauseit==0)? copyspeed: 0
6 t: k7 x O2 C) P& Qvar iedom=document.all||document.getElementById
& A; v. `2 I9 D, [/ y! M3 Uif (iedom); ?# w. e; k) p' w5 r8 h! a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 O; Z7 [5 ^$ Q6 r/ Q/ d
var actualwidth=''
5 {( [6 y9 M1 Q, K) t5 Pvar cross_marquee, ns_marquee/ b$ {1 P4 e* N) b7 s* p/ V7 e4 U* l
4 Y6 G( r5 Z5 \
function populate(){5 q/ w( o, b' I4 K
if (iedom){* j# e4 k1 m* O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& Z. R) p( o6 X# b9 ^6 C2 g
cross_marquee.style.left=marqueewidth+80 V& E' l# ~( M
cross_marquee.innerHTML=marqueecontent! X1 n& d9 P8 r( z% N& |) q; {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
x' |/ [3 C) T* f q7 E7 N}, F$ b7 K) ~6 M9 [( r# l4 {
else if (document.layers){
/ ?7 g8 A' w9 a4 `' }; k# U% m/ ans_marquee=document.ns_marquee.document.ns_marquee2
3 G3 \. B: e7 ^' @ns_marquee.left=marqueewidth+8. i: @. w! t- R& _8 m- G2 s, k9 Y
ns_marquee.document.write(marqueecontent)
4 B: B# C6 c: E; [ns_marquee.document.close()
' z% N0 B) m1 G& m; Hactualwidth=ns_marquee.document.width" F6 S1 I( n1 j1 n
}
& Q2 n4 e+ _& Slefttime=setInterval("scrollmarquee()",20)
+ u% V' y1 f G6 L+ R}
7 j2 [! f& o5 H4 uwindow.onload=populate
: [( {2 W2 i! G3 ^; b. Z: y0 O6 v( S2 s% P, r ]+ d! P! g
function scrollmarquee(){5 q, w. G% Y8 W u* v! S2 Q6 U
if (iedom){3 z7 d1 ~! A3 U+ b, }/ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( W+ e& _. t* k% [7 O0 i) y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; c5 @! `+ X: D& g
else
1 g5 m# o9 A5 [. N( x6 J. ^cross_marquee.style.left=marqueewidth+8
7 _# }4 t! A* r8 ]) Z4 V+ s; X& u& P- j [
}
% B7 h. K$ K1 W& u% j# O! Kelse if (document.layers){5 t2 J4 I6 u$ m! I$ w2 x
if (ns_marquee.left>(actualwidth*(-1)+8))- i/ U9 A8 q( i2 _5 j, J
ns_marquee.left-=copyspeed
# q! N9 z8 X% L8 i: X1 relse# @: u1 G, ?- V3 N
ns_marquee.left=marqueewidth+8
, ?7 n2 a$ M7 n8 p}
& M4 p8 l3 q9 s' R}* r3 W5 k; c5 o+ T
) I2 y7 {) c6 w. `! H
if (iedom||document.layers){3 V$ W+ \: k, F- z
with (document){
% j: S, T$ |" j9 k: C4 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 b% B+ y" W+ M* Gif (iedom){
( }6 y3 o1 ~5 v: A8 S' g4 A5 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& n3 [% |0 s) Z- ~4 w" v" B/ lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 [; w8 |7 W. i; }% w7 ^! Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. @1 D! Q0 G( u' ?write('</div>')
. B* O, x# ]3 b}2 D- `! q0 f, |6 \3 d3 Y
else if (document.layers){ W/ q2 `) p; E/ X7 h1 u1 U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ |9 J) c. ~2 P- y* Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( v# j& V5 C0 L& S: s& @& {
write('</ilayer>')
$ }2 l! [& D+ H- V" P}+ r" r9 ]" M7 G: m- x
document.write('</td></table>')- w8 p# o) r1 T$ o5 W" P
}
2 s3 M9 a v, H$ M: g: y1 w}3 I# d0 p7 g6 D' w
</script> |
|