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

|
网页之跑马灯文字特效
//修改宽度: J6 n% ~) q% z; X! c) E% l" I
var marqueewidth=300# X0 z1 J3 s3 C+ m+ n7 E3 D
//高度* \* {1 v1 j& J0 b8 r
var marqueeheight=25+ |- D. O. o# X7 ~6 O3 Y9 [, q
//速度(1-10)5 n' j0 `5 T- D/ p
var marqueespeed=3
o6 Q; H/ b; O//背景颜色
8 M3 h, U. c: ^) j/ @var marqueebgcolor="#FFFFFF"
# m4 E7 j/ R. E9 s; y# x//是否能暂停 (0=no. 1=yes)?
7 k: L* E( E+ Q0 R* p) S- avar pauseit=1, _3 ^( f$ ?. c+ X
5 S6 a! y5 {* x. z: _5 K2 V/ @
//修改显示内容9 G* Y1 j+ ~6 {. D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* a. `! r4 p; c( X# [
; A0 z, A6 C% {4 e8 w& H
3 h5 d& O+ t7 t8 E
////下面不需改变////////////0 }4 n" }: O9 c/ I# L: ~
. A( L' G1 q R/ @- O9 L( B7 Z
var copyspeed=marqueespeed
) n7 E# |* c, m, d: _var pausespeed=(pauseit==0)? copyspeed: 0
, B! ?& P7 F7 E2 W, }var iedom=document.all||document.getElementById
( {0 U0 l/ K% b7 a% t9 k+ Lif (iedom). Y5 a) S& I! [0 Q4 C$ e2 R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" W" P7 r0 x" V) S; A" F
var actualwidth=''8 W4 Z7 j/ V# J- S8 ~4 k
var cross_marquee, ns_marquee; ~7 s' n; O# p+ V* n7 a) ^5 \
4 G: I& o; } t* y4 Rfunction populate(){0 N. ~2 U! @' O3 u
if (iedom){/ G/ b7 x: C" ]0 x/ e/ u( |- t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 H4 |( B/ x1 ^ T
cross_marquee.style.left=marqueewidth+8+ v9 d. f( Z2 _7 x- d
cross_marquee.innerHTML=marqueecontent0 r& ^) \' f8 @& U$ r5 T, V+ h8 ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) C6 h4 X6 }) M; [; G
}4 ]9 d2 ?3 ]& O% C1 q3 j
else if (document.layers){
7 z& M. i5 e! z7 L+ [$ }ns_marquee=document.ns_marquee.document.ns_marquee2
( D; y8 W3 A( ens_marquee.left=marqueewidth+8
+ _! e: M( v# Z6 i, jns_marquee.document.write(marqueecontent)1 W& U3 \% A z( @
ns_marquee.document.close()3 t: M( a5 }( ^) f
actualwidth=ns_marquee.document.width$ \ u, j( x: e/ a7 a, ?. O
}" o) V, ?% ?! t. |6 g2 M
lefttime=setInterval("scrollmarquee()",20)1 F6 G0 o6 E5 I& |& _- E; R
}
) D# ?9 X, {1 K+ i* Jwindow.onload=populate2 V U+ y! k0 }1 m4 ~7 u+ }
0 o+ B4 |6 C+ Q0 L6 n
function scrollmarquee(){
6 w. E- ~: F, D5 K' z7 yif (iedom){
j( Z( W1 Q0 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- g1 ^ p, @! k. g! B- Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ }2 R% I: n, |' B) uelse! d" ]. w& L1 s
cross_marquee.style.left=marqueewidth+8, T7 _. R- m/ S: y# h2 ^& i
; T' `8 u- T8 z+ v
}
9 d- v4 O1 j# Z9 Y; {else if (document.layers){
) T( G: E: E( m& D+ eif (ns_marquee.left>(actualwidth*(-1)+8))2 D. g, V/ \! ?3 `. I" `* m
ns_marquee.left-=copyspeed. j1 v" m* C: a5 A" h2 K- e, H
else
1 {; C7 m7 J8 l! x3 bns_marquee.left=marqueewidth+8
2 I( M& q( D7 [# p! w5 c}& v* g5 w7 ?9 M! U
}) e! f) T, B7 k2 l, u" g
/ ~& G) |8 O8 a* k4 Cif (iedom||document.layers){, y8 ?. s# R1 k' `- b
with (document){
; g" Z# a* d* l+ N1 A* i) c/ Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>') p1 l! [+ j5 M% t. M2 H1 } u) k
if (iedom){
) N' E4 c+ l% J( s( g5 B# ~! swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 r0 @, r' @' bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
h' x( m+ v @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); _0 d8 U& Z' v! B+ B' p, g
write('</div>')
$ s0 m' V/ d6 b3 z8 x' S}
8 [* b1 S- s5 Welse if (document.layers){
& B4 ?6 ^# H- S, y. Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' ?6 x* e6 T/ T$ |$ ?" E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). O) F- a' C# S$ M
write('</ilayer>')0 `; ]2 U% l5 O Z4 Q7 p8 B
}1 d( V7 Z; D! b* b6 M4 d5 ?
document.write('</td></table>'); T" x) h: d+ {! y6 ` D
}
: p, q6 z: I$ ]# G: B4 k}
* R, S! P/ `9 E+ A</script> |
|