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

|
网页之跑马灯文字特效
//修改宽度
4 x/ P0 `, G) z" `+ x0 ]! Vvar marqueewidth=300
: k7 t9 H0 U3 w' ~//高度
; a9 D# H0 k5 f, Pvar marqueeheight=25
2 @5 J5 O2 W7 Z% d7 Z* R* e//速度(1-10)
, X: I* u7 }- x2 U7 s& S9 k) bvar marqueespeed=36 Q' x+ S$ o1 h
//背景颜色
: t1 m+ [- T) Fvar marqueebgcolor="#FFFFFF"
6 P( x( c, m2 D; E% s. w//是否能暂停 (0=no. 1=yes)?
! ?: |8 Q ^ e& a+ zvar pauseit=1
3 M4 n; a, B- f/ z/ j2 }; n, v/ D5 e& O1 U! o
//修改显示内容. B, Q! ~1 }; v% z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 a) S! o( w4 L+ a; P
) m- f) X% y6 f1 j, r! i( ^- n0 Y8 J' s7 ]% W' ]
////下面不需改变////////////
6 Q2 _ L" G' _" ` U2 s* T
2 T4 _6 e( z( P' L# Y: ]! Nvar copyspeed=marqueespeed( Q0 @, Y8 s. B' C8 j3 Q h
var pausespeed=(pauseit==0)? copyspeed: 0
8 @% G! f- y' Q. @5 B: K) A$ i3 Tvar iedom=document.all||document.getElementById* ?. ~( I* W/ ~
if (iedom)5 j8 r( O, y/ [1 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 B% j. [3 s+ @$ X2 K, k
var actualwidth=''
- h" i% t6 `$ {! r9 A3 J! F8 svar cross_marquee, ns_marquee
f) |( w7 d- G+ ?
, e6 T0 x- S% M; z4 S4 J& A7 y" }function populate(){1 R2 f4 q( Q; J+ ~
if (iedom){
: R3 V, Q* M& D' O+ X" icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: Y& B' }1 Q6 x7 E% E
cross_marquee.style.left=marqueewidth+8
; Z7 w/ r& y8 r: `8 Wcross_marquee.innerHTML=marqueecontent
3 \ N, H- P% g" l! }9 N/ hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ R$ R# b3 a+ E( W2 Y% B' ]}4 c/ u7 X) ]- K D9 U: K1 r5 m8 D1 F
else if (document.layers){
2 b& m7 C/ o# d2 d; y* c" G H ^ns_marquee=document.ns_marquee.document.ns_marquee2
# z' U! K# H' T* C/ c8 \/ Ins_marquee.left=marqueewidth+8
" m$ c9 x1 k" z) g8 \8 R- xns_marquee.document.write(marqueecontent)
5 t, p! @ v$ X+ kns_marquee.document.close()- a2 J8 Q# x, S: f! S6 c& y! i
actualwidth=ns_marquee.document.width
3 D0 n$ p6 N- \, f/ e( D9 _}1 `& t; X$ Z! t& c t
lefttime=setInterval("scrollmarquee()",20)6 O2 P9 I' D6 P& a" d9 l
}
7 Z7 S9 t f6 }window.onload=populate
1 I6 H. c( U* q* @
2 v/ o; l% u J5 _$ e( Nfunction scrollmarquee(){0 L) S& P: z2 x" o0 ~+ X
if (iedom){: z4 l) p! `2 O/ o4 z* w( o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* _% u% F" i+ F8 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* J. i" K9 Q4 e jelse) p2 J8 j- ?) g0 W) Z
cross_marquee.style.left=marqueewidth+8
3 j' p5 T) ~" o. i( |" D( d6 ?2 v3 Q% A& Q( [/ \8 X0 y
}4 ?8 t2 @" o5 j3 |3 r p G& r6 E
else if (document.layers){
# k. K- y7 Q$ n' x) E- Bif (ns_marquee.left>(actualwidth*(-1)+8))
0 P8 \# p9 ?: Lns_marquee.left-=copyspeed
0 z2 i0 p9 `2 J" p, G2 O( j O- Lelse
7 s! X$ q( F0 Tns_marquee.left=marqueewidth+83 p. i8 u9 \0 q, z7 u `
}
A. |; K$ W+ l5 a* r+ W, g, F/ b}
% L5 T# G! a0 V# z$ j) U1 [1 ~1 S+ {' |9 c, u
if (iedom||document.layers){
& p l9 |: E" L. V4 e$ r' uwith (document){
; ^& E- t+ @/ ]* |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. d, v/ a, n, z4 hif (iedom){
8 c, Q' D1 u* A7 P! wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 Q* e% W2 O7 j7 p6 wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- g6 v0 T& \! ~4 _4 j$ hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 C! y D8 B9 @) a5 {' w
write('</div>')
+ k. t+ T& D$ a' F& d. O2 |: x0 U& }}3 ]+ m3 Y, k0 Z9 z( n2 D8 N
else if (document.layers){! X3 |0 w5 u# V, w* h: {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" j% Z/ q8 Q: O+ z8 |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) G" c# \2 Q; r, i$ `# p. L
write('</ilayer>')
+ }+ ?( P& _' ? C2 M}
( v: g( [7 k" Q! b9 ]2 G G* u; ?document.write('</td></table>'); _/ }0 q K* v' R# b. P9 n# K
}" o9 Y* u0 v7 k) Q
}
) K0 p0 f% B; i O0 d; W4 j9 `</script> |
|