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

|
网页之跑马灯文字特效
//修改宽度
# ]6 E# L! F1 e) q6 }2 |var marqueewidth=300" z, |" X& z2 O3 T- G
//高度4 V o; V; K' B" K0 I
var marqueeheight=25
! a" A3 L* a/ o6 F% c0 z0 s//速度(1-10)3 M: | z0 f5 U, L& J) M1 ~
var marqueespeed=3 j) |5 e, @/ u. q0 h
//背景颜色
9 f* E, G5 @- ?var marqueebgcolor="#FFFFFF"% h# D$ F9 {2 b$ s
//是否能暂停 (0=no. 1=yes)?; z+ V) _8 e0 x+ u) X* n5 `# C8 [
var pauseit=1
! _. Z3 |1 o# J ^/ m8 I* h0 @' b3 p* U1 x5 K/ V) Y
//修改显示内容9 x- Y" t3 r! V6 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 N" e. F- {& Z: X+ n7 _$ O! `
2 ^4 c9 v8 i: `. U" L
! F( U5 N/ g t
////下面不需改变////////////
b8 f, t. K8 v* D
" M1 V* Q% O0 |- @. Rvar copyspeed=marqueespeed
2 [* i$ F& S. t# ~7 d3 y' x6 Xvar pausespeed=(pauseit==0)? copyspeed: 0" C X4 c2 e4 P4 x: f2 [
var iedom=document.all||document.getElementById
; Q" `0 N0 C& C6 V- a. u7 hif (iedom)
6 t" p8 H4 U9 |+ V; D- adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 f/ C* Y8 |3 P. ^5 b
var actualwidth=''* k; h; ~! b2 p/ d4 ?1 R) E: u
var cross_marquee, ns_marquee* s0 w' }/ i/ }1 X! ]+ V0 f% U* I
: x, r" ]( b8 |( x) L0 Q9 \7 nfunction populate(){
6 m* Z( F3 D1 l1 o8 s* E7 t5 hif (iedom){7 c7 v3 R- \7 o b' g) M$ Q; o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% q8 x. ~7 j- M$ a5 o
cross_marquee.style.left=marqueewidth+8
' m7 P6 @ b6 U& Ocross_marquee.innerHTML=marqueecontent
. [4 y: f% I# x- T% ~8 |5 p4 ]. ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 D/ Z- D3 H5 C}8 ~0 _- u) f4 g& N4 E7 H
else if (document.layers){
) Q: d& O! F9 \6 W3 |1 fns_marquee=document.ns_marquee.document.ns_marquee2
- O5 J+ {6 I( D+ o2 i) K( x$ ons_marquee.left=marqueewidth+8
* _2 N# @: K% x( G$ nns_marquee.document.write(marqueecontent)) r8 \, c: _& X- C( I! @ A7 O
ns_marquee.document.close()( t( u5 N9 U7 d/ L; }
actualwidth=ns_marquee.document.width& `) e" S4 d" r! _" |& s* }
}, J3 f l* x9 |' @9 Y( n" ^7 U
lefttime=setInterval("scrollmarquee()",20)1 r% p! p! a0 {
}1 ^. k5 K( x% Z! R
window.onload=populate
* V+ @& k1 ^ u! K
3 A- |" i$ q6 T" m/ r) y) Zfunction scrollmarquee(){
( J' E, |% h D; dif (iedom){# o8 x5 m* z: t/ o. n3 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): f" k; V- }! @& T. K ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: H* d; R3 j3 [/ x
else
0 O/ m+ ]3 \, Z3 v) j! D% rcross_marquee.style.left=marqueewidth+8
! f1 S8 f. F( q! X: X8 n! Z) s% {8 B' a9 t/ j$ k$ n/ H& ?2 x5 o* F
}
/ ]) b1 e, E% welse if (document.layers){
8 u" `2 `; N! cif (ns_marquee.left>(actualwidth*(-1)+8))
+ j) P$ G: p$ e9 N) d3 Ens_marquee.left-=copyspeed
* R, u: T0 p* d6 relse" x( u9 k W& m, `+ p0 j' b
ns_marquee.left=marqueewidth+8
, j& k% M1 k5 }' Y) I. H+ h' \; t}
; S4 h4 M! s7 r}' ~$ e, c. A; q' K8 a4 W# K7 _
6 U7 e6 [2 X ]" Vif (iedom||document.layers){
* \: R) z0 O2 w, j4 L. Qwith (document){$ H, W! [) O* a, @- r( W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 k. q4 Q2 u2 M+ ?2 k' l
if (iedom){# i1 x4 }8 @' ]0 B, b: {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ E- K# h& D! x* ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ |4 Y, P8 i* U9 I4 R$ m& K; k, uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) ]1 ?& R! X. O6 P/ C& z2 `3 n5 ywrite('</div>')
- J) f, _9 @9 C Z} X% p/ W, a) K, G# h6 n
else if (document.layers){
5 ~) `8 U+ n% T- ^# W1 Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# A) ]1 V" `7 `( L! Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 N% L/ v5 E7 r3 r- G) _. N: j2 _
write('</ilayer>')3 g: Q+ J1 y; E' w( V/ b2 t
}
1 C2 f! I' q2 D$ n' Odocument.write('</td></table>')
8 s; n, s' \7 G, Q3 Z}
; ?0 d0 ?: U( ^' }3 g}
! T/ K# Y8 e3 V$ ]" _1 D$ J; ]) j& U</script> |
|