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

|
网页之跑马灯文字特效
//修改宽度' C1 j, {8 w6 Q3 o3 u, Z* x0 p! j2 k2 v
var marqueewidth=300/ \5 A% k% Y& \9 R4 U8 S
//高度
; h$ z8 w) E' M8 b0 O5 M% x# V# ]var marqueeheight=25
" B4 c& @7 S6 Y0 H* r//速度(1-10)
& s( u( ~7 u3 k; yvar marqueespeed=3 I. f, X5 D& Q, Q$ x8 |/ Z2 V- I
//背景颜色
6 ?9 ^0 I5 x2 }) S$ V% M, X' B5 r6 v& Wvar marqueebgcolor="#FFFFFF"( k! J" p; d/ C
//是否能暂停 (0=no. 1=yes)?; R( E% W3 r& u% p
var pauseit=1
& m# H! [ F" i l R( v5 h3 e, U* B: W* x& e# n
//修改显示内容3 [ z# H7 g" |* Q5 R" G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 G8 L7 }& N0 U
* s3 w8 x9 @5 z! F, t4 ?; L' I
8 k$ q+ A9 k$ i; x/ Q
////下面不需改变////////////
/ B2 w3 J6 M$ [, d$ X- w! E8 o; M+ x" N# }7 E) J# S
var copyspeed=marqueespeed; R8 Z3 ~ Y4 Q$ v D
var pausespeed=(pauseit==0)? copyspeed: 0$ V- r/ o7 t# @
var iedom=document.all||document.getElementById: i! ^3 M) {0 g8 S
if (iedom)) R j$ O: e) O7 m8 ^5 g |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 J+ k; f% |7 R( y5 f. N) X8 i
var actualwidth=''9 b" i; s) ?* _0 n
var cross_marquee, ns_marquee. g: Y% k2 t3 z9 g, @
' U8 M6 O2 [3 O! Q8 [3 ofunction populate(){
/ D8 M. r( v0 }* Cif (iedom){$ F: x. }1 i2 C" U1 n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; j! R2 j4 u7 l. G; ^% Ycross_marquee.style.left=marqueewidth+8
7 F7 H U4 c. P6 S* _cross_marquee.innerHTML=marqueecontent
& O" }$ r: C1 z, }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& e! R0 M8 J! W4 ]
} k9 a% ^/ h3 x* i7 h
else if (document.layers){- {' J3 @" Y3 h) @- x- F
ns_marquee=document.ns_marquee.document.ns_marquee2
- i2 P [( O6 A$ J+ s D; Yns_marquee.left=marqueewidth+8' e* T, X( o8 K [+ V9 `4 n
ns_marquee.document.write(marqueecontent)
' X% w. h5 B x- _3 }ns_marquee.document.close()
- W: y% k6 u) Y, r: e/ dactualwidth=ns_marquee.document.width
5 y* c" h) S& S' ~0 z0 B- n w* ^}
; C) W7 y- R+ G9 |# a% ?: Klefttime=setInterval("scrollmarquee()",20)
5 _. _$ x: M0 _0 k" L. u9 ~}# F- c$ B$ w: ^7 k0 y4 A( D- g
window.onload=populate8 d6 t8 f0 u+ Q3 k
: s2 _0 m, S8 R4 M# ~, P$ q) b- f
function scrollmarquee(){7 [0 c# H: V' {! ~
if (iedom){( f- Z. f3 d0 Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' \- \* Z/ I2 `* ?! d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 A t+ s( J- O- u% a4 ~( _else
( {9 B$ ]. h9 |) B/ ~5 Ucross_marquee.style.left=marqueewidth+80 z1 ^) e9 N7 r. q4 W) ^
- n5 s/ Y2 W1 D; {" b% c% F}* D/ {+ ^: {, [1 Q
else if (document.layers){' A$ Q8 f3 R2 {5 t2 `3 M
if (ns_marquee.left>(actualwidth*(-1)+8))3 G" a h/ M! n$ k* J
ns_marquee.left-=copyspeed$ @% p- t) e, A5 D! f, C j
else. e4 X5 r+ R/ Y
ns_marquee.left=marqueewidth+8- P6 q7 ?- ~4 @6 {3 g. ~: M. p
}
; T* c- q7 z& Y0 \: ^, z) F0 A}! ~' q, ~' x- j3 o: r
4 Y- \1 i/ Q W. l8 T( Q
if (iedom||document.layers){
Q5 _5 e) l- u. ]/ b/ Gwith (document){$ X- M3 `, ?. m/ v) e v: Y# w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ ~$ Q" L: r a$ {if (iedom){
# | [% A1 R7 ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 _# b4 w. X, e8 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 d2 n+ ^1 v0 \4 l+ W D, R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); z. s: r$ F- b9 u
write('</div>')/ l! s: X. y% S$ @8 I( |
}/ s0 a$ B+ s. ?
else if (document.layers){
- j* g+ ^# I& b# Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 D9 W: M! V7 Q0 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, t- f9 h6 n$ r2 g; X! `7 C$ zwrite('</ilayer>'), z; F& l* D( ?7 f1 M% _8 O
}
" J2 L" Z* |1 i4 s: Y1 P( |; K& w4 _document.write('</td></table>')
) a; }+ X- k5 o# A}; g: n: b& j( g" B# F; ^0 f
}$ \2 I. U3 n0 c8 e% ?
</script> |
|