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

|
网页之跑马灯文字特效
//修改宽度* L- N& w! J! R
var marqueewidth=300. \# b" Y3 ^3 T: u
//高度- o/ h% y; r6 o8 `% ^& e7 M( w
var marqueeheight=25) O: C9 m4 [4 w" p
//速度(1-10)- t& u' t/ o3 o& M- K
var marqueespeed=3: _! Q U0 ~ T9 Z& L- g; G. z( N. M
//背景颜色" A/ Q5 B' @. H( c" K2 h8 A
var marqueebgcolor="#FFFFFF"3 m7 z p6 a4 c! s) I# k
//是否能暂停 (0=no. 1=yes)?
6 c: R: \/ h7 W; [7 _6 m0 rvar pauseit=12 G! o& e8 q) ^7 W5 U$ J& G: Z/ i8 M
9 F ?5 b7 I1 q& H3 y
//修改显示内容
* T1 _- d5 n) p/ H& pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ Q. N6 a N; g& N% X+ X* e/ v9 M" Z2 g' D
' l$ t" s2 _; c. X
////下面不需改变////////////
2 Q, n4 u W; E4 k; j9 Y% O' Y* `+ S- l( _% }: b
var copyspeed=marqueespeed
H" T$ k7 |+ ?7 \var pausespeed=(pauseit==0)? copyspeed: 0
1 h8 e% {+ c2 C- \5 V; T/ G% }/ j& o8 Hvar iedom=document.all||document.getElementById
* u2 I& Q' {) Kif (iedom)7 |* i! z% t2 P+ z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( L( Y+ M1 j) z1 q( Gvar actualwidth=''
$ F5 M& ~* X* P% ~var cross_marquee, ns_marquee
5 d: a; j+ C0 a3 A8 w( @9 [9 m+ s' x' [' T$ l, Z) S
function populate(){
1 a! l7 E1 u9 U+ Oif (iedom){6 Y1 p( `0 F& ^3 i+ }$ n) F; O+ n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 i5 O3 P1 [5 {# j
cross_marquee.style.left=marqueewidth+8- |( w. A5 }7 k+ O3 {+ z
cross_marquee.innerHTML=marqueecontent
) @0 U% ?, y5 A' Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" {4 W& g- ]" K+ _7 `* j! @
}
1 N# i. Z: }( Q3 K: X3 c L2 ~else if (document.layers){
# s5 Y$ V4 P: T1 ^' Vns_marquee=document.ns_marquee.document.ns_marquee2$ |) s7 i5 d. Q5 D: z( V
ns_marquee.left=marqueewidth+8/ k* n+ _* U) u
ns_marquee.document.write(marqueecontent)
7 [" X) R6 y% K! \7 F wns_marquee.document.close()7 K/ V( Y% P0 B$ x: x
actualwidth=ns_marquee.document.width
3 ?5 V( }! L+ l0 E: U R}
/ ~9 @* ]: z/ M+ S4 @; G& t1 wlefttime=setInterval("scrollmarquee()",20)7 E5 }7 k% \& r& n* W
}" t8 `/ w6 M+ [
window.onload=populate
. a" r5 m% [2 C
v: _& A5 Q( f9 o4 |# |function scrollmarquee(){
- T. C e. ?/ B! Wif (iedom){# W! n% i u. @; r8 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ w+ x. L2 U8 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% t( y( ]' U; z/ Telse, Q5 I. f, D2 _; \$ Z; |
cross_marquee.style.left=marqueewidth+8
, P3 G8 q2 A7 b7 _8 _3 m/ k2 k- t, A
8 c6 j) l% t; ?}
; _/ ]2 I# [7 z1 w' k$ [- m. }( uelse if (document.layers){
5 g5 _8 A% C+ l! N' r4 x. jif (ns_marquee.left>(actualwidth*(-1)+8))! g* ~+ ?5 e4 A/ F' a! F- f1 t
ns_marquee.left-=copyspeed
' O# c# [, M& p7 {" `5 Delse# k, m3 V8 Q( [" M2 t
ns_marquee.left=marqueewidth+8) J' n R. z. E9 b$ c
}' F" \+ I; M3 M. u1 O: c' w0 `
}* G$ w% r" `7 E% }8 h
, x3 j% q* y5 a. i1 a# T
if (iedom||document.layers){8 v1 _& P" @6 y7 [6 P
with (document){
. R" r7 T3 d' y6 T5 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 W; |+ H9 ?* i7 B
if (iedom){
- n. y. c: U' r/ n' xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 n/ H9 b# u7 s) F8 l( \8 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 [+ M j {" |: |( ~2 Y; ?& dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): m7 ~6 k2 Z' l
write('</div>')
3 _8 U; G* P* r5 r( y1 r0 R& t" [}, Z1 A0 Z! y& e6 D
else if (document.layers){
( n" w# u( R: V$ x( \, x) \9 i0 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 X' {6 C% P- L }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ Q# G( D3 M2 k( X2 Y# P4 K/ Twrite('</ilayer>')8 P3 I( U# I+ m5 f
}
! |0 L. W0 N0 S$ `. m. l( jdocument.write('</td></table>')' I, ^3 J1 |; q$ j) k
}
! o9 E+ \& I% y( m* \7 D/ c}0 p8 c3 j9 ^8 d/ `4 h/ b
</script> |
|