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

|
网页之跑马灯文字特效
//修改宽度% ^9 L) |& [1 k: y( p+ v5 n
var marqueewidth=300- h) ~( Y& S2 W% L9 }) P
//高度" z! \( X6 q* z O
var marqueeheight=254 b- G# i* I1 {4 J! v+ f$ ~
//速度(1-10)
4 X9 a: r8 ]' X1 n7 lvar marqueespeed=3
. O T/ v. ^; ~2 ~5 }9 @//背景颜色! x" C: `" j0 }7 c7 D) V0 [5 x/ x
var marqueebgcolor="#FFFFFF"
2 n/ ^" b5 }4 C8 w6 D" `% V6 \4 M//是否能暂停 (0=no. 1=yes)?2 V& w+ D4 x% D2 [1 C: Z
var pauseit=1( X g5 ]' {5 R9 Q
U- Y$ c8 I& t9 r) B
//修改显示内容+ t* q' _ ^3 \) u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 g# c" o# H. W1 h, }' ]
% s1 }* W7 i; o
G5 t( Z9 }2 N( a9 U////下面不需改变////////////
0 F5 ^& ]% V" R% _) q' X) P+ B
$ Q% Q( r8 a8 `4 u! rvar copyspeed=marqueespeed
- c. ?4 U6 @8 U/ ]% a6 B. Xvar pausespeed=(pauseit==0)? copyspeed: 05 m- [0 } _3 d( E c
var iedom=document.all||document.getElementById
% f9 X0 [, s: b; f8 U1 i% Wif (iedom)
2 G9 G' x# P# |7 U. d& Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ b. \* A" F% g. O ^, K* Z- u5 c r0 pvar actualwidth=''
* u* B/ i* q3 n9 \var cross_marquee, ns_marquee
: u( S6 a+ @" H8 z: j+ d
( Q% o* j+ | G4 Z: \% \( jfunction populate(){
) t9 X) n% [" y2 t, {* Tif (iedom){8 q; |) s, a3 ~8 y/ V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" D- w! O$ S. C/ U z" l+ m. c3 {cross_marquee.style.left=marqueewidth+89 Y# |! j% j( z& w4 c: _) U9 p
cross_marquee.innerHTML=marqueecontent
0 y' p' g. l% h. c' C0 X7 U2 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 U% \$ `1 ^( h5 E! U/ v* f}9 P3 i. P& ~6 g6 ~7 L! H
else if (document.layers){0 q" \+ K" |9 e5 {- | N7 R+ A
ns_marquee=document.ns_marquee.document.ns_marquee29 s. O& X4 w: g0 U, S$ I4 L) E
ns_marquee.left=marqueewidth+82 s# ~5 T4 }, o% Y
ns_marquee.document.write(marqueecontent)
$ D# F0 B* q- H. K! rns_marquee.document.close()$ U. h8 w+ R, X1 s
actualwidth=ns_marquee.document.width
# v/ W7 O9 K/ |7 D6 A* A}. v4 h6 o, W) ]0 q4 a
lefttime=setInterval("scrollmarquee()",20)
: b# H: H. T$ k9 s; A}
7 g7 Q( H; T$ {# B' r1 O5 pwindow.onload=populate! o; Z _ ~5 u2 m
- o: w1 m6 M7 g# S- y
function scrollmarquee(){" \1 A# Z0 M: Y7 t: q& U
if (iedom){
2 C( _' A0 q" g3 V& jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 V h9 @" q0 X* T; |4 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) N, P4 D# Z% S) I2 Y( E
else6 f! c) B4 o& `
cross_marquee.style.left=marqueewidth+8
2 I/ d5 j0 }5 T. B, c) r/ N+ I) E
$ q' I' J) @1 H: T" t+ e' c2 f}* W$ C2 _& E3 ]/ T* j
else if (document.layers){
; s' w3 c+ O( [: eif (ns_marquee.left>(actualwidth*(-1)+8))( w+ v2 _/ Y. b/ r( Y/ }
ns_marquee.left-=copyspeed
! O" y) F: X! [# |- R2 Oelse
9 z! g& P: i* ?ns_marquee.left=marqueewidth+8
' R6 l& t& c+ W5 c. I}% u& i9 P; |9 }! C/ ^: b! ]2 g# L! q
}3 d) t7 j+ Q: B1 c \' I
! n/ V, s, ?5 g: Y+ \0 Mif (iedom||document.layers){3 s# S3 x9 ^. [6 F# a6 }
with (document){
6 {" ]7 c0 d8 l% Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 I( S" S* w$ _% z9 e) g
if (iedom){
/ G: o3 j* V* G6 B- G" _' v& swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ K3 P# [& L2 V, u' a7 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') E5 ]. m2 K$ X8 n u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 c, k& t1 y6 V& m3 i" J" H+ q Lwrite('</div>')
5 ~1 |- ^# \ s$ U* U}
& T# P- f( `9 g: Relse if (document.layers){
8 h$ Q3 D. W4 F, w8 c: A2 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 z3 N& l+ p5 z, c, X# Z1 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% s9 Q$ |# m. x8 P
write('</ilayer>')
' ^$ F) c, n& M1 i! w}( v, W+ y0 X1 f6 |3 S) E* p
document.write('</td></table>')- L! a# x2 u1 Q, f1 m4 A/ [
}
$ Y* a5 m/ }/ ^5 S0 ^}& _8 a$ o5 [, A, _/ q H, U
</script> |
|