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

|
网页之跑马灯文字特效
//修改宽度* L, C- o" x0 D# c. a" X1 B
var marqueewidth=300
) u4 `- Y8 @$ {* y//高度8 J/ \5 j# f0 n, T" U3 t
var marqueeheight=259 R1 c2 Q2 u! h
//速度(1-10)
# Q# n. P. w' M( C2 A7 o9 b9 ?4 Mvar marqueespeed=3* C' H! A* Z& ~/ u. w' \6 N: g
//背景颜色& ^0 s; q3 H% u9 E& S8 |2 f
var marqueebgcolor="#FFFFFF"
1 @# f, W3 U9 C4 J//是否能暂停 (0=no. 1=yes)?
) Z3 m) T9 F2 X) Svar pauseit=1 X4 O5 C, b7 U
$ H, U( I7 l/ J9 J//修改显示内容- M- E8 z: ~- f, b1 L' e' P" L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; }$ m1 B; j! q8 z5 d
y6 K* G* b0 H3 O: k/ h6 A' d
9 s# R u- e. V" P" P
////下面不需改变////////////5 B2 S# v4 c$ ~9 P+ k2 s2 ^
7 v* G2 u8 W' I, {% hvar copyspeed=marqueespeed) w' ^, a6 {" O4 T) B* J
var pausespeed=(pauseit==0)? copyspeed: 0
1 t- Y3 o6 U9 Z9 x1 Lvar iedom=document.all||document.getElementById$ O2 f9 \% C1 P( G
if (iedom)
3 o3 r( N4 f+ P0 J/ jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) w* k. P, _, }, P! ?. j6 evar actualwidth=''2 V0 }$ |1 C3 G# @
var cross_marquee, ns_marquee( C1 G% p+ {# M5 _
* L* ~% h3 p1 `5 Q/ z
function populate(){- B2 o" l& l/ @% \2 h9 Q, g7 |
if (iedom){1 ~2 I' Y; v3 r* R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, ?. R8 `$ O. C4 W' \% S: R9 Ncross_marquee.style.left=marqueewidth+8
& l; x# }6 _# ?5 D+ @cross_marquee.innerHTML=marqueecontent
: g: d) I H& I6 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# I& W, R9 \- L5 k8 E7 z7 O5 Q
}
( ]# L k" b1 D; Kelse if (document.layers){
" o( t$ ]. X) b9 |2 ?( ?) Kns_marquee=document.ns_marquee.document.ns_marquee2) X+ k% T' R+ ]5 j+ }
ns_marquee.left=marqueewidth+8
2 V' }: s! H9 G) ]8 H' N* sns_marquee.document.write(marqueecontent)! j# F9 I; ]9 P/ U
ns_marquee.document.close()
" p9 _* s) m8 t1 {0 a7 B' iactualwidth=ns_marquee.document.width. z1 A4 A/ s3 _( c! g" E( U
}
! b; V1 p( B) c; F @% z6 [lefttime=setInterval("scrollmarquee()",20)0 u* F+ B, z' T% g, c
}
`* X5 z% Z1 w2 X. x, Jwindow.onload=populate& }$ D& \' x/ d+ `
: z1 h0 U# {& bfunction scrollmarquee(){
7 d* u) U v, [: t2 Lif (iedom){% X) P3 q# I3 y: K$ A/ d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% I \8 H% }9 i( q; n& across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: w: \8 }7 F: x; Q( y
else
8 Y% @ s" _$ z# A3 _# Q0 @cross_marquee.style.left=marqueewidth+8
+ }! b! N+ W. q4 e1 s9 k/ ?, q
8 z; _( L9 S2 r( {9 a7 C, v3 ~5 q5 A}+ K3 {; x) A8 Z, A& U# N6 g" c
else if (document.layers){
+ @" n; `) |% p0 c6 O- {" e9 Mif (ns_marquee.left>(actualwidth*(-1)+8))& a9 F: c8 q) M; q9 S
ns_marquee.left-=copyspeed5 q. j. @* A3 F' v) K) q! _ Z6 g
else# p0 l+ w% n/ ~# w" |, H
ns_marquee.left=marqueewidth+8
; f9 {% o# J7 N9 P* h}7 U+ b% e K6 V4 c. }; }
}
& z) [+ ~& F J# l/ ^+ }# |( c. {( |
if (iedom||document.layers){
9 s5 }/ r& P+ Y' U5 }: F2 Hwith (document){
: b- ^5 ?$ ~* f) m8 Q, r; |7 tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 x+ a$ }# F4 A6 L! H( A3 Iif (iedom){
5 g" g- Q( z* f8 k( ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) y: w, T8 u4 ]2 i2 Y$ z. ~2 E) {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); r+ @# I5 n0 @& L+ O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 o. Z) K) m% U3 N
write('</div>')
. E/ H T* W5 A; N4 {}
0 V5 C' q7 h$ W- A) ?5 G: }5 oelse if (document.layers){
* t2 z0 u2 N4 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), J$ X6 N8 ~& u& p0 i% ]% A& \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 }0 d. k& x# |' a2 Z' |5 Ywrite('</ilayer>')) C' d' e& e# V& T
}7 I/ j& V( G, [8 i/ o% q, F
document.write('</td></table>')
! h- T+ I$ _; [8 o}# Y7 S8 B2 J9 q/ A. N
}
V z& n# A! P. ^+ `, S</script> |
|