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

|
网页之跑马灯文字特效
//修改宽度, `+ \. G$ S. t6 E/ D, q
var marqueewidth=3009 [/ h) j5 @/ l$ H7 u* U$ E4 c
//高度
0 \+ ?" O9 h+ k& s- W- j8 Dvar marqueeheight=25, ]( _$ `, P: G
//速度(1-10)
{) L1 w' ?" y N1 Z9 k- ^var marqueespeed=3
& h5 A9 B5 ~6 Z$ g7 e0 i1 N//背景颜色
4 `% X4 C& E# |% v0 G& Rvar marqueebgcolor="#FFFFFF"
8 g6 t+ D0 n! d& f+ i3 l//是否能暂停 (0=no. 1=yes)?
0 R. d% k* W! a2 R |9 ~% dvar pauseit=1
6 m: |+ g" A- e- W
3 a; N% W- B7 J5 e+ ?//修改显示内容
, ?( t3 y9 w' V( pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& Q" Y7 z# m( z5 v; [$ T: R% K# Y. N0 ^% h4 v
5 s2 X, [) G0 A; r# W6 r& ]; i////下面不需改变////////////
. ~1 Q# `9 j# u
0 d0 k; e: S5 }2 a: yvar copyspeed=marqueespeed4 S. p! q4 p! s
var pausespeed=(pauseit==0)? copyspeed: 06 t2 }. r2 u6 h2 F2 R4 s1 g- |
var iedom=document.all||document.getElementById2 E$ t7 ?6 B$ x
if (iedom)
3 G U& K4 A1 q5 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: B' T% [2 x* ?( Nvar actualwidth=''
* z0 v3 }& H# Y! T0 t" t Uvar cross_marquee, ns_marquee1 a" s: N* s6 H. K
2 e8 y( o0 W0 G# ^4 H9 C) C: bfunction populate(){$ ?6 Q! \& h8 ` Q8 ?) q: B s
if (iedom){
$ L: E& j/ q, [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! d' |8 `: r6 R; A- w! ]: f8 Dcross_marquee.style.left=marqueewidth+8
# U! |4 {$ y$ E3 b4 \9 ]cross_marquee.innerHTML=marqueecontent* x) X: A' R/ M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ p8 k c Q5 f2 p. ~! t4 c- h& u' G3 ~
}
M* f" A# i" h& j: C, ]) Yelse if (document.layers){
- s& W7 I9 z! qns_marquee=document.ns_marquee.document.ns_marquee2& Q0 x8 t8 W' }2 F/ j' b# Z
ns_marquee.left=marqueewidth+8/ v) w! m! @- Q5 F8 X* @; `, Q
ns_marquee.document.write(marqueecontent)7 V* T0 c/ d( k6 R8 K( n
ns_marquee.document.close()
i4 o! z( D1 v: L4 J$ ^ I6 ~2 ~actualwidth=ns_marquee.document.width
! h8 Q0 Q( ]9 f* S4 y$ Y0 F}
1 o6 w" ?6 z2 n, ~. \4 K9 L3 K& \lefttime=setInterval("scrollmarquee()",20)% p3 t9 Y" W& N: u5 T
}
0 X. J3 n! ]# L( q1 o6 wwindow.onload=populate
- j" I# ^1 v1 q7 Y+ O/ A, }; F8 q4 f. A- f* E
function scrollmarquee(){
0 W, Y6 Q* y. bif (iedom){2 a1 Q, Q( V1 d. p) Z. i. ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& q+ \8 |( z6 P6 j; H9 y5 R. v1 D( x' zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! L1 {$ U& u, o
else, E5 g) z6 d0 q
cross_marquee.style.left=marqueewidth+88 }/ `0 Z1 H9 k, r3 Y3 \7 o: W) Y
1 d @8 i. ~1 E3 P: m: X/ K! w+ E}2 T( M" L5 w* o9 |4 J. {) s
else if (document.layers){
6 _3 \. ]4 `5 |, f- \$ }" V2 Z& I& uif (ns_marquee.left>(actualwidth*(-1)+8))# H! {: S4 @4 X; b- i- Q
ns_marquee.left-=copyspeed
: S* k" g7 X0 y- B; F4 ^else# ?3 [0 P( M- d6 D8 T- d1 F0 Y
ns_marquee.left=marqueewidth+8
: d$ W, g; T" m; f7 F, \}
( V t- c& D9 H: h+ D+ D, ~} S, Z5 e% G- V
0 f- |! V5 U- _9 z1 wif (iedom||document.layers){
: k: b0 T1 I% m( _5 l3 i2 `( bwith (document){/ n- m0 y# D4 ^! Y- X- d) ^( p+ z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* d3 \! w4 G( T2 x; ]* B; Iif (iedom){
' B2 o+ L4 ]1 p# z# bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ V" I7 c7 O# H+ T6 D1 o! a# c6 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 w) D% o8 z8 g0 _0 G; O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" W4 O7 C( G5 k; y9 p
write('</div>')
1 q% y9 p& Z/ X# u( A9 w9 T8 H}$ L& y4 Q2 W) y: m! y; [
else if (document.layers){
9 f9 |! J6 {6 s: B/ kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! S1 C$ \) M, ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 ~0 |8 n3 G- A" h! f+ C* {5 o% ~, O
write('</ilayer>')
, _3 y6 R" l% B! _5 ~3 J) E) t}
# ?, \% F+ L( K, {6 Gdocument.write('</td></table>')9 s( [* q- Y$ u1 }1 t# k& l
}
& [; j& q! Y) a; L4 u" S& P}! m) v) a- X d- l* D3 @
</script> |
|