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

|
网页之跑马灯文字特效
//修改宽度. C) ?. \* ^+ t% ]# y
var marqueewidth=3004 Q6 S: v1 t) \, V
//高度 T, U( p; I6 C3 ^$ s; f
var marqueeheight=25
- Z; ~- P1 n- }//速度(1-10)8 X" i! X/ q. f* H6 H- D
var marqueespeed=3
4 c2 a1 p& D3 x0 V, A//背景颜色 p0 }+ X9 {' S" e6 `9 A
var marqueebgcolor="#FFFFFF"7 W& E, i: ~0 K
//是否能暂停 (0=no. 1=yes)?
/ Z1 s8 W& j! @ Zvar pauseit=1
4 O% Y6 w* z4 B) M9 N4 ~/ i+ p% k2 G
//修改显示内容
" [5 U* t: Q5 Q& ]1 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ _6 }# [( ?/ \# Y" H; W; t$ \/ |
8 A. w5 L' @: Y8 n1 E5 J1 \" ~! ?0 e ]2 T1 \
////下面不需改变////////////
9 n/ |7 B* o* Q
1 W+ a! p! W. Fvar copyspeed=marqueespeed
o7 W4 L4 ^5 i6 V( @, yvar pausespeed=(pauseit==0)? copyspeed: 05 _. j7 T1 Q/ t6 I2 `7 g p
var iedom=document.all||document.getElementById! T* f q3 c+ J. G$ w9 x: h
if (iedom)
9 q$ ?* h5 N/ [4 H/ u8 T' Q; _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ ]9 X, d1 m9 U! H: @
var actualwidth=''
, J' R( E, [' gvar cross_marquee, ns_marquee
6 M# K3 z* V: x
6 {6 K$ q/ t" V' ?function populate(){
7 k1 ?1 S; ?. M1 ^if (iedom){" n9 P0 w1 _& m: `) Y% m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 @1 e5 a) O+ s$ ]; `9 p' u9 Ucross_marquee.style.left=marqueewidth+8
+ I; o- X. }5 e( _* H/ Ocross_marquee.innerHTML=marqueecontent
; J8 E) V9 o% kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) {9 W# W( @3 o: P4 y. M
}
6 G/ f- K, s7 C, X. m/ Q% Y6 welse if (document.layers){
& @. W% d. H. h6 cns_marquee=document.ns_marquee.document.ns_marquee25 L# K. U) P+ Z* J; f
ns_marquee.left=marqueewidth+8
9 I( T" X7 C4 @- j$ x! g$ ~ns_marquee.document.write(marqueecontent)3 `1 i8 E& L" }; Y
ns_marquee.document.close()3 L1 g/ t! v8 \/ c& ]
actualwidth=ns_marquee.document.width; c5 m- W2 M( m- k/ E) Y
}4 ]5 d7 A1 M) m1 l5 j: i
lefttime=setInterval("scrollmarquee()",20)5 y) E4 _, _+ I' ~1 n5 Q" h( C% {
}5 |1 k4 ?% T X6 e8 P2 W9 M
window.onload=populate
! l+ A" c [. M5 z: Y) z$ m- y6 b% `' A* K! r" U- G I* p% z
function scrollmarquee(){
" J8 M% p! M9 h7 @8 kif (iedom){
# H0 M/ e1 a1 |' ?: nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% \" m0 m+ P$ \, i6 U; D9 S9 b. B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 Q5 n n J! w* A7 V
else5 d- ~- l/ [ v) l$ x+ o$ t
cross_marquee.style.left=marqueewidth+8
; E4 ]3 C: t/ W0 j8 g
d+ n4 v' D! H0 x) e, q% j}
7 o1 N4 A, W# e, belse if (document.layers){
( s2 h4 g5 V$ \- x% Tif (ns_marquee.left>(actualwidth*(-1)+8))
2 `7 A1 @# j- x" y# j+ G% [; mns_marquee.left-=copyspeed2 x n; F. z/ o/ m2 N, H
else
- C( @* i5 _9 d2 ~& `" |ns_marquee.left=marqueewidth+8$ g3 t& e7 ?7 O: w r( @+ p
}
7 Q% W, q& h9 A% y- |} s0 R- M! z- v0 z% c
V& m" b. M# k3 V, Sif (iedom||document.layers){/ R" Y9 n8 G! c3 w0 r- t) R
with (document){9 r% t; Z3 M* M2 M% u+ s9 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 T/ d0 d& Z7 y( C( V, mif (iedom){
- K* J6 E/ [3 D6 e( Y- y6 N) Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" f6 N, U6 A3 ~0 e" Q( f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 }9 @; A4 X; v& K7 Y2 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# h: b& L. z" @. Y" D4 K s
write('</div>')# L% @, b! G0 v5 `& a
}$ R) i ~& c; r* g3 x2 W: e
else if (document.layers){
8 g2 I1 Y, a: N5 b8 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! S% L c. F* y0 h" z2 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 N. M8 G0 n1 i3 e7 l; J
write('</ilayer>')
# |3 P J2 C6 e s, ]}3 w# u- g% S, w3 Z
document.write('</td></table>') S# r# p% ` a' {4 J8 Q
}, ?* P1 L, \4 d% O) S" C: n
}
5 O+ n, ~ Z3 ^, b$ X</script> |
|