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

|
网页之跑马灯文字特效
//修改宽度/ \' A& i$ e. n0 x X# E" I: H/ l
var marqueewidth=300
$ J+ O4 H* B3 W- ]3 R//高度2 V9 I+ {- l5 d7 `+ L
var marqueeheight=25- i8 ~! H* d5 h @4 y* k1 U% m
//速度(1-10)3 D7 p' h1 o* O- y P
var marqueespeed=31 H: D# Y& L# J, l3 X
//背景颜色% t$ X. C8 i) V% V7 ^3 s
var marqueebgcolor="#FFFFFF"
( S7 ?/ I) _ |' T0 [//是否能暂停 (0=no. 1=yes)?! o) R- _) ~! W) o. z; E/ f
var pauseit=1
/ t& J0 w! K- m$ e0 p# w w+ \ U8 ]2 N
//修改显示内容7 E* s- C; W9 ]9 f' g+ q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( R: P) o* ~6 ?# y% `' P% |
; l! ~! { I$ t, Z3 B6 j4 h
5 Q! Y5 x7 Q/ P* M0 z. N& b
////下面不需改变////////////$ l" \$ V" ^) Y" K3 T) Z
6 P$ p+ V" }1 k3 V3 i( a! p7 ~
var copyspeed=marqueespeed
5 z( s4 j+ O7 [. W& lvar pausespeed=(pauseit==0)? copyspeed: 0
9 F- w6 a# C1 L2 E3 Cvar iedom=document.all||document.getElementById' R2 Z( n( O$ h2 ~: f4 R8 i
if (iedom)& v( Y8 X/ ?; v8 _6 X$ R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 F8 K" R9 ^2 {( U( Evar actualwidth=''
7 [3 `2 x9 j- `7 Y# r, C1 M6 n9 yvar cross_marquee, ns_marquee
$ \2 d. l9 S; K; R( I0 z# s" Y9 k4 `- k8 R. Y
function populate(){2 h4 O, m& o: K6 r8 Z+ ~) a
if (iedom){+ h/ @! h9 C, H: A* M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 Z$ C1 ^/ c7 L7 g
cross_marquee.style.left=marqueewidth+8
+ S' Y, q; V/ D9 P f+ dcross_marquee.innerHTML=marqueecontent1 ^3 c* F6 j; R+ V' {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ l" _. Z! c& ?8 U: J4 `9 [" `}
7 [) F" U5 {% j$ I' felse if (document.layers){
( b4 p: b8 g" J7 M7 Kns_marquee=document.ns_marquee.document.ns_marquee2! u8 x# m3 v% H E
ns_marquee.left=marqueewidth+8! ?$ u, t/ a5 a/ k8 J2 ?
ns_marquee.document.write(marqueecontent)
/ \! S$ }9 l: ?' Q. E; y, I; ]: bns_marquee.document.close() U/ T( R3 X N. K( u
actualwidth=ns_marquee.document.width
1 }: i1 h6 r3 s}
* e3 l0 Q* T1 }6 C3 \$ t" h+ J& qlefttime=setInterval("scrollmarquee()",20)) |2 u, |8 g9 t. \: s8 @
}
+ J3 h9 X U6 W e! cwindow.onload=populate8 d3 d" F h7 n3 }, u" Z$ a4 Z
2 G r/ Z5 @7 Q* G3 K. ^' rfunction scrollmarquee(){" d, P6 M# U+ i/ i6 |
if (iedom){3 j+ @ l. C3 ]% l" x$ A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ J7 `8 H L, B- o6 wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: t b2 k! ]4 u' D
else7 M; L3 d# M% X3 j5 u1 m) o
cross_marquee.style.left=marqueewidth+8
& i6 O! T8 S( D! R/ n5 ?2 A- w' I! I# S2 L
}, _6 x1 q) }& s
else if (document.layers){, d4 D/ k" {# \% a' R u% R2 R
if (ns_marquee.left>(actualwidth*(-1)+8))
* i2 K/ o+ G- ^9 Ons_marquee.left-=copyspeed
, P$ x( B" j: b2 nelse
. j n0 n; L: B6 l( W. {. ~ns_marquee.left=marqueewidth+8& |5 X& E# k+ W {. {, Q2 T$ r
}# M( m' D, k3 S; r9 H/ d* V
}5 p* X5 x3 O. x% t& W! G9 G
9 P: \( I& O! Y2 o) I2 mif (iedom||document.layers){. ]. \' i+ g$ C2 d
with (document){
" u2 d* q+ ~( L9 r2 Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' W1 u" ~; P/ ^9 Aif (iedom){8 G% P" K- v0 C0 v$ y6 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 X$ H c6 i6 o) F3 Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# L$ r$ S# L' K$ g6 vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ H$ ^0 `1 J, B0 R, X9 P- P. N* s- U
write('</div>')
! }5 X9 m8 X' D# U; H}6 i F" s, Q9 f- a; D
else if (document.layers){
3 h( O4 T" O3 ]: z% J2 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 P9 y, Q) r* r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 \& ]2 _- r$ l* u( a) Y
write('</ilayer>')
% H! r; {: c7 {7 h q: _}9 G U- f! l$ i4 n
document.write('</td></table>')" P' Q7 m2 t; u7 b6 E2 P
} x8 {2 ^6 G) [
}5 f5 ]& a Y) E% B+ Y4 q/ Q
</script> |
|