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

|
网页之跑马灯文字特效
//修改宽度3 }5 [* O Y0 g9 B
var marqueewidth=300/ m: K f6 I! M1 u! x
//高度: @7 d! u5 S. Z- }" s9 Y! b
var marqueeheight=25
" C2 O6 ^2 Q& a2 }( f//速度(1-10)
$ `- Q; S& k% dvar marqueespeed=3
0 y0 |( l' f% e6 k" v0 S4 f//背景颜色 M | y5 C/ w3 o9 U9 T/ u7 Z
var marqueebgcolor="#FFFFFF"
0 a; T% o/ ~) v$ `3 q' I//是否能暂停 (0=no. 1=yes)?$ {( Q* a2 B$ r W3 J0 ~8 j2 B
var pauseit=1
% P4 _4 {& D& Z4 T2 v9 p8 E6 l% y0 |; t- \5 g; W V+ h
//修改显示内容
+ i0 |" y7 X4 ?5 G9 wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; n N6 Y' J: s- m6 M( @2 J7 I$ F) |. ~5 y( W
) ^5 `. _! |3 |: U" f////下面不需改变////////////; \7 c! z8 ~5 X. q+ y1 L8 P- p
& F0 z. i# `, b$ X% tvar copyspeed=marqueespeed: J- f5 Z- L* ?% ~; P. g a
var pausespeed=(pauseit==0)? copyspeed: 0
) O4 Y" u# ]! l1 t: f! p9 Lvar iedom=document.all||document.getElementById; S' j/ Z. i# ~( m1 z7 {) s
if (iedom)
3 n. i$ `$ D9 T7 g2 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' f4 ^# c* Z2 J7 M+ S- u+ C
var actualwidth=''. _% ~# p; n$ u; V% ]4 ?' X2 `
var cross_marquee, ns_marquee I* K) l# O& R n1 t$ T* `+ B" W) v
* B+ f- m3 |) o+ _. ^9 bfunction populate(){1 y- k* n* u5 o, m
if (iedom){
% Y- X/ G/ u' U" }: Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 D8 q0 o" z1 J4 ?* ^0 Pcross_marquee.style.left=marqueewidth+8& h! Z0 {0 h% e$ A( O
cross_marquee.innerHTML=marqueecontent
2 L9 J& C* L9 @5 Y8 X0 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& t" u$ }9 \- A; S) x' j}
7 { i* O W8 D5 R/ g8 s. ielse if (document.layers){3 j/ v2 j [) Y% x" H5 F* F! u
ns_marquee=document.ns_marquee.document.ns_marquee2
% ^1 \* g1 }/ Q7 wns_marquee.left=marqueewidth+8# I+ ~; q, S+ R
ns_marquee.document.write(marqueecontent)* W. Y5 k/ R- b+ w4 A
ns_marquee.document.close()* X% a! t" t" G% N3 C
actualwidth=ns_marquee.document.width. t8 R0 l" B: T3 q+ J4 Y$ |
}
a8 I0 v9 Q' B, ]- `* mlefttime=setInterval("scrollmarquee()",20)
# a+ s- ^# o" H6 h; ~" y9 M}
- D, |' R) O+ z2 T; w4 xwindow.onload=populate
2 V W# `; Z' r- G% i% v% L/ `( F! Q; s' Y; s4 E
function scrollmarquee(){
. T% D7 P8 q: q: ^" W8 pif (iedom){
/ c% S" ^" k% y, fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 Y: @6 C. n0 G8 L# ^ j# \5 \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. d) q$ g' N o9 U1 G
else) L. j; P' K! y' O
cross_marquee.style.left=marqueewidth+8% S' A0 e5 R8 K, o0 _* B
9 S" f- `" V0 Z$ `( T+ q5 D
}4 z5 y0 k8 T0 _: G
else if (document.layers){3 z% ?9 d" a; k8 I
if (ns_marquee.left>(actualwidth*(-1)+8))
8 [1 n' U0 ^3 h) D$ N0 k$ nns_marquee.left-=copyspeed% U0 v) y. J, V
else
# u; z& i4 p# D! q* r. wns_marquee.left=marqueewidth+8$ Z9 V6 O# n ^' K5 X8 D3 {. A' K8 _
}
' ^5 l$ n+ B$ r+ ^" |' {' C( H}+ L1 B: y9 N3 c# {) n* ^
, c# h. U8 y4 \, D8 L+ lif (iedom||document.layers){
: M$ V8 S$ J" q5 Q$ Gwith (document){
/ h* q# k; `8 [: C3 N+ |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 {- X" g l7 w0 W" X" Q$ W
if (iedom){
: u; p: A6 h9 A- I2 J( u5 N$ dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 E& V9 X" u4 @, f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 N% j# J0 `3 o9 l" j, H: Y& bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 [9 ]; _, ]- W6 N! S
write('</div>')
" K' R8 j, }2 l% W6 T}9 U; J3 a- v6 W5 k3 g1 o4 g; B
else if (document.layers){
9 F; }. P5 _* ` Y3 p' Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# h; g! E% F' V1 d) w& E( f/ awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) h. e" j' ?, Y$ J! owrite('</ilayer>')8 s B, X0 z# ~# I
}: e$ x- Z9 @/ G, m1 r: i7 \
document.write('</td></table>')" t; n9 ]- l: D9 d w1 X
}
# ]6 a6 |9 s& X1 }}4 Z3 R1 R7 ^1 g
</script> |
|