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

|
网页之跑马灯文字特效
//修改宽度
% B* k1 {0 _' b8 B, \var marqueewidth=300
R0 k5 P, x( a( n//高度& y/ b5 m! k/ Z
var marqueeheight=257 H1 E) h6 d3 T& ]$ `
//速度(1-10)
) `9 _- g1 q8 i$ U6 y, G7 {var marqueespeed=3
# C) k$ H$ V. b. A: j//背景颜色/ R2 _: y! q# F5 ~
var marqueebgcolor="#FFFFFF"
! H: Z" m, m! b( W//是否能暂停 (0=no. 1=yes)?3 y2 j1 X3 O4 f; S* U( c1 [
var pauseit=1& M7 L/ x6 g8 t2 e1 A x0 v
& t4 n" d4 `, S. ]' P4 B//修改显示内容
^# @2 b7 N( [, tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& |( y3 R7 L" B# I
2 e$ F, [. [ y6 R$ B# ^" r# D
; F. M4 x3 E6 O" T/ e& y2 j& Y////下面不需改变////////////
% X- x# j* s9 h0 i* s
8 X& }9 ?' m& l! t. Avar copyspeed=marqueespeed n& a, i& V P8 q H
var pausespeed=(pauseit==0)? copyspeed: 0
1 }/ J Y8 J( T# Ovar iedom=document.all||document.getElementById
! x% z" L) ]- k3 s: Iif (iedom)
' i7 n, }4 i7 z. V: u% rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 Z1 f' j: H3 H' n; pvar actualwidth=''
5 o' V4 L! H* ]; [8 ]3 avar cross_marquee, ns_marquee
( A4 n p) h' G$ f
$ ?+ c& }& E2 Afunction populate(){0 r$ ]! V/ w" [
if (iedom){
' K3 d2 C, V- i. D, }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& O0 q7 M$ D$ U) a" d3 Tcross_marquee.style.left=marqueewidth+8
& K0 a" h8 f, Z3 E# D) r( b0 Ecross_marquee.innerHTML=marqueecontent, Q; N; b! E3 o, X7 F: W9 A7 Y' Z6 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% m1 E" k3 N6 B2 k' x4 c
}7 |6 ]+ G- T4 M- j" A; C4 ?. ?
else if (document.layers){
9 _2 d+ N+ L l' o2 o1 Ens_marquee=document.ns_marquee.document.ns_marquee2
6 n7 E8 j& o+ ]( l gns_marquee.left=marqueewidth+8
. m+ Q, Q* c9 E' `0 j$ E9 hns_marquee.document.write(marqueecontent)4 ^7 K8 [% k+ F( y% \2 C% o
ns_marquee.document.close()$ @$ c. H% S- G0 N7 T
actualwidth=ns_marquee.document.width) W' s1 w2 I" _0 s Q: j5 Q$ |
}. l% R4 U+ h$ X2 l. S
lefttime=setInterval("scrollmarquee()",20): P$ |5 Y$ i* m& A0 T6 N$ e
}% e5 |* O; ?( q. E( w
window.onload=populate) A) B, N3 z; Q9 b2 s
$ n' {8 B1 Y) d/ I& c* }$ L5 x
function scrollmarquee(){
" s" Y! s V1 d1 y; O( Wif (iedom){9 \8 {% a5 ~9 w" y8 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) u3 ?& c2 U% `& D O. W+ ^- N# a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ h7 ~, \* g. `1 oelse/ A# \1 n6 L" T: {9 O7 O
cross_marquee.style.left=marqueewidth+8
( t" d/ f/ s. }* f( \+ i4 L2 O) J% y( l# I+ n9 }9 Q. j# P4 E9 n9 c
}+ {3 b! w+ o) ^+ ^' |
else if (document.layers){
% N% p& J6 u K3 ?8 _& ?2 Lif (ns_marquee.left>(actualwidth*(-1)+8))
% V8 ]7 i, ~) T$ Uns_marquee.left-=copyspeed
" y" w+ F5 h3 P( Kelse2 ~: s5 n; E2 Z- l5 }
ns_marquee.left=marqueewidth+8: C! f' X' I# g% S, G3 K
}
, c2 G$ [$ C* V' k& G+ c8 j}. L- H9 W$ {- n$ @/ d6 ?
4 T2 V' w8 I- d+ y5 t) J& Jif (iedom||document.layers){
) P* C" A$ Y; a3 Q- _with (document){: p$ p/ Q% Z! W5 {1 X Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 f0 K3 B+ r7 ^6 i( O. f+ h1 O
if (iedom){
+ w# z7 l7 C7 g7 K4 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* z8 X4 e8 g$ F4 Q% b% K H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( E" Z) V% G8 N7 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ Z" `4 i: P: c/ O
write('</div>') C7 Q) M/ w& U( C$ f/ [
}
0 ~" j5 |+ ~' ^2 d _$ F! `else if (document.layers){
* L0 a" B" h/ t- j0 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! ], I- I9 U9 Q/ s Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 ^+ b5 ~6 Q7 k) d+ B2 C5 Z( Ywrite('</ilayer>'). I7 D& C, U* v7 Y& `/ o4 A8 i5 v
} l+ r" d8 c: U8 F/ f% e$ n% i* T
document.write('</td></table>')
" `1 Q' R! g9 |9 x* Z. R}
( N( D$ x( l0 r0 g; E4 G: U+ b$ c2 t}
/ A8 S( f1 c% E# @</script> |
|