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

|
网页之跑马灯文字特效
//修改宽度& J, _7 ~" @9 H6 b
var marqueewidth=300
* i! U# ]+ B' B( M. E# j//高度
. v2 R% n+ ^* A! U; r- _var marqueeheight=25
' ]) O" _$ b5 c2 S; f# b7 z5 o//速度(1-10)
) V) z5 _/ q0 H" I- T+ Jvar marqueespeed=3
) R( u- R' x; G* E//背景颜色, W- Q0 b8 \, B& d
var marqueebgcolor="#FFFFFF"6 D, B" J/ A, m8 |
//是否能暂停 (0=no. 1=yes)?
4 u$ E9 Q; G, H/ C$ ivar pauseit=11 u4 {! [0 O+ o
' h9 T# c! ]2 i( y4 J//修改显示内容) W- @; t0 M9 ] {' R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 \% Y0 Y, R) k6 U( S
- w3 n. K# Q) N6 y5 B6 N
# m" ^$ n+ @6 h" ~! n0 i////下面不需改变//////////// [+ ]0 n. b" j o9 b/ `3 ]+ E
( p3 ^) p2 z0 X8 R3 a
var copyspeed=marqueespeed
1 K, U% Q [; B1 i, L( evar pausespeed=(pauseit==0)? copyspeed: 0
3 U( Z7 i4 {. m6 tvar iedom=document.all||document.getElementById
: j8 O( v4 r* j; dif (iedom)9 K M" D' Z/ Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) A7 F; u" t* H' A wvar actualwidth=''
/ [$ K% j3 X" G# C- o6 avar cross_marquee, ns_marquee, @( M% E% u/ S) ]6 ^
. i" ?. W7 l; R# j) N" K! \7 {function populate(){
, X+ g" A( Y9 z( g2 Z8 Hif (iedom){4 b0 U4 N5 W1 }6 `) W& o' Y% \0 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 Y/ M+ u4 q; O4 X# N3 }7 zcross_marquee.style.left=marqueewidth+8
, f% q) D- U+ V# p0 m# vcross_marquee.innerHTML=marqueecontent
5 ?; i9 o" E8 X0 Z/ R8 k/ l0 R' Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ |3 W; V6 \! ]! |& _4 o, h
}$ {8 o; w# T% ?7 o" _( l: F
else if (document.layers){
/ a2 x% y& Z' p6 t. j! c# n2 ens_marquee=document.ns_marquee.document.ns_marquee20 W( V4 ^# b% y3 s- R& [0 K" T. S
ns_marquee.left=marqueewidth+8
/ `& j8 r' p7 ^ns_marquee.document.write(marqueecontent)
! w4 Z% P+ Z5 Y S, N* o+ A, P3 W; ins_marquee.document.close()( U$ F; z. a+ ]8 B6 q, \- f
actualwidth=ns_marquee.document.width
% L3 W. H$ f) ^}
$ X4 }# u/ e+ f [lefttime=setInterval("scrollmarquee()",20)
' A; i2 ^( N9 S+ r0 o0 ^}
7 N' {! `0 E& u8 D' R- Hwindow.onload=populate" H2 o+ F6 K1 ]0 b0 k1 g
S- V1 i0 F X, u3 H" Z
function scrollmarquee(){4 H; ]2 f# ]/ n; j( E) c% l
if (iedom){
4 J( r+ ~" F7 C$ K% Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" _, f. w) P1 }& c9 `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& i, e5 |- p2 j, ], Welse7 N9 R$ A0 m$ e' M2 i- f
cross_marquee.style.left=marqueewidth+8) D: t$ N8 S! N" j6 K2 [2 f
3 T9 [: ^: j5 A" U; ]& P}
; R# S3 V$ D9 d) F0 C _else if (document.layers){
+ \5 ]3 l; [2 x$ M) f" a1 m! iif (ns_marquee.left>(actualwidth*(-1)+8)). c1 N4 |! K/ o/ L
ns_marquee.left-=copyspeed
8 d/ `; D; b9 oelse; `5 G6 ]9 z8 |+ f$ b5 }8 @
ns_marquee.left=marqueewidth+8
% v/ c1 e. ^% ]5 L: w; g8 N3 z}
2 S: [/ g) Q, H1 O! {! c! f}
- @5 @. f/ e0 z! u/ K+ b/ g* U
. X& N0 e& U5 n3 ?: l6 n' d/ n) D r) Gif (iedom||document.layers){4 ?" P' [- U* C* `
with (document){
/ u3 K6 u5 g7 r6 l; y- _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 v+ Z; x9 x7 D1 y' jif (iedom){' H& L8 A* s9 @4 N7 L$ |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 ` h. l! y/ V$ xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) N( y O5 {& e$ q% \5 _; f8 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 p% P4 V. u9 j, A a
write('</div>')% b! C0 a* ^& n3 d9 M0 b
}: ]( y' @. a3 r" S
else if (document.layers){' k% y$ @- a8 l) T! k" `. c% W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 @3 @1 m! T2 l# h U. s C' mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 j- w& f3 |" G# O6 E
write('</ilayer>')
4 e8 T5 C6 e. a( S7 h- W+ q* L7 V5 r}) [; u Z/ r$ J2 \8 Q% S2 o8 r% u& H
document.write('</td></table>')
7 H' z0 [0 W) `& I* @}
, b/ J' V. |3 W& a. F! L% w; o4 T}
3 S& K" S9 g" W2 j; }4 y9 K4 _</script> |
|