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

|
网页之跑马灯文字特效
//修改宽度, Y* b% Z: h5 _, a* @
var marqueewidth=300' J3 _; f" H" p D
//高度+ P0 A$ h' w% v. r8 H
var marqueeheight=25
{2 R! v! d z! ?/ c//速度(1-10)$ q- B) U0 A8 Y: a( \" h
var marqueespeed=3& [8 a- E4 w, \- @1 _" y, x
//背景颜色' g1 G( A9 z! t, y
var marqueebgcolor="#FFFFFF"
" X u, o" C5 ?- n* Q% ]//是否能暂停 (0=no. 1=yes)?, f q0 i$ R; j( w
var pauseit=1
' ~' `8 x/ Z% z2 p& c" u3 I ~3 U; r% l) A: o2 J2 C1 j4 c% t. p
//修改显示内容
4 k, q, p& N) V4 }. c, d6 Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': S$ M" v: m6 W I
2 s, i, a8 r; P; b; L: P0 a
/ a2 S8 c0 d2 `& w////下面不需改变////////////
6 T, q& L/ S, k' g0 K9 _' T
9 A6 ] [* n4 D* D2 qvar copyspeed=marqueespeed
* c0 i0 L- [8 E( T3 pvar pausespeed=(pauseit==0)? copyspeed: 0
' Q+ c# R3 _$ i# u- V! b2 Ovar iedom=document.all||document.getElementById, A, M; T6 O ^4 P! d
if (iedom)
( `3 O( h4 [) s) _) ]# z4 Z* _9 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 M/ z; o9 ^- W' c5 h4 j" Ovar actualwidth=''
: z/ ~! C. H( O. bvar cross_marquee, ns_marquee$ ~* p' U1 [2 Q$ _' i, k. @1 Z5 f
: \# x' W! o' D7 ufunction populate(){
7 Y( l, ` C1 k8 H6 H& _4 Eif (iedom){
+ z. j0 f% d2 r! L0 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# m) C* K# \# n0 Q' n9 A- Pcross_marquee.style.left=marqueewidth+8
- L3 f0 A; r, Z1 l% k& J8 scross_marquee.innerHTML=marqueecontent7 F4 E2 p! a7 |" U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* [2 O, }; T$ W: [& H
}
9 ?9 q$ k w0 W9 relse if (document.layers){6 V% L# a+ @: H! }+ a j
ns_marquee=document.ns_marquee.document.ns_marquee2
5 S5 C4 b0 H+ k+ Rns_marquee.left=marqueewidth+8/ D0 j8 h; m* }. D7 Q- b9 l; J+ A
ns_marquee.document.write(marqueecontent)2 j4 d9 F' Z( ]% |; e
ns_marquee.document.close()
3 R c) T. g" ~/ y- x8 ]9 tactualwidth=ns_marquee.document.width# J, ?- Y% V# C8 }) ^- ~5 ~9 u
}+ [3 ~( E, ~. z" O. Z! S
lefttime=setInterval("scrollmarquee()",20)0 S+ `( m8 A& ]+ i5 R
}% i7 C O2 X. i5 U" m# w2 I
window.onload=populate
% W8 v' _6 B6 W; z: _
d" O5 g. n" Y- o4 w' Nfunction scrollmarquee(){# ]6 x% h4 N( k' I* a4 P
if (iedom){' Q# ^6 k6 ~4 W1 Y( X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ n2 w1 w- h- ]. ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! b2 \5 t, d9 ]$ ?2 i
else
: D8 N f# f2 }/ ?cross_marquee.style.left=marqueewidth+85 J |6 C" D; L4 ]& z
! d/ |; W6 S3 q}
K8 P. L) o- Q9 h! r* \else if (document.layers){
, G% y1 L4 x4 [9 uif (ns_marquee.left>(actualwidth*(-1)+8))2 ^' t& B6 C; o. C4 L- \
ns_marquee.left-=copyspeed
9 {6 _1 F8 e* @' Zelse
0 O V/ g+ A2 v2 V) xns_marquee.left=marqueewidth+8* _, j" H/ ]8 f h, g5 E& w. |
}6 c* G( c! W3 k* G0 z2 U
}
9 G) ?* @; d" k
/ k0 X( ` J9 p% Z" a$ yif (iedom||document.layers){! x6 V+ C4 C& d* b9 O- o3 m# g3 O9 p
with (document){$ w% O$ b9 C$ s1 A7 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 n$ w# J. S g# U/ g# zif (iedom){
% p' A* M: `5 J) D; R Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 ?3 o7 _$ n+ L. Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 x6 t( V# L/ _" dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- w7 j7 `/ _! E7 t/ X$ a% Hwrite('</div>')
6 D1 ~ ?' t. t( L3 T( {! k}; [& T0 L u; i( U
else if (document.layers){* h+ E o) u3 n Z: ~: L9 D+ k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') A4 ~- l; n6 ]7 M* R, o7 K. V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& w! B6 M' D0 b9 C" _$ U- {
write('</ilayer>')
# v( @# N$ v! S7 L}# B6 Z; D- F8 C& M* q
document.write('</td></table>')6 ?3 T4 [1 A+ O4 ^3 F
}# U1 q9 ]% \0 V/ V4 B! F9 Q
}' Z* X! d: Y- z! s K5 w) ?
</script> |
|